Commit graph

68 commits

Author SHA1 Message Date
RincewindsHat
d28bab4dbd More wrong printf formatting 2021-11-24 19:02:17 +01:00
RincewindsHat
e2f24a5af3 Fix CodeQL checks 2021-11-24 14:25:42 +01:00
Aksel Sjögren
3f9b22ab16 check_icmp: Fix pkt perfdata in check_host mode
Add missing "warn" threshold field in "pkt" perfdata output.
Perfdata should be interpreted as;

  'label'=value[UOM];[warn];[crit];[min];[max]

With one field missing, the hardcoded min value '0' ended up in the
"crit" field, making applications interpreting the perfdata thining that
critical threshold is always exceeded.

Signed-off-by: Aksel Sjögren <asjogren@itrsgroup.com>
2021-11-15 17:55:49 +01:00
Tim Gates
dbdd0f972a
docs: fix simple typo, conspicuosly -> conspicuously
There is a small typo in plugins-root/check_icmp.c.

Should read `conspicuously` rather than `conspicuosly`.
2020-12-19 17:14:23 +11:00
Jacob Hansen
4a4ef0d689 check_icmp: Do not overwrite -4,-6 on lookup
In case we needed to do a lookup, we previously overwrote the
address_family to IPv6, even if we supplied -4 as a cmd line argument.

This commit should ensure the cmd line argument is always followed.

Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-10 14:39:13 +00:00
Jacob Hansen
ca6efcd02b check_icmp: emit error if multiple protocol version
As we do not support checking both IPv4 and IPv6 hosts in one execution
we emit an error if multiple protocol versions are defined in the cmd
line args.

Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-10 14:39:13 +00:00
Jacob Hansen
7a660b3f01 check_icmp: move opts string into a variable
This commit moves the opts string into a variable as it is now used
twice.

Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-10 14:39:13 +00:00
Jacob Hansen
0882b4201b check_icmp: Correctly set address_family on lookup
If a hostname is supplied instead of an IP address, the automatic
address family detection would fail to correctly set the IP protocol
version (it would always be IPv6).

We now supply AF_UNSPEC to getaddrinfo, which should then return the
correct address family in the result.

Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-07 09:51:21 +00:00
Jacob Hansen
e5eccb663e check_icmp: removed outcommented code
Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-07 09:51:21 +00:00
Jacob Hansen
e3ade3374a check_icmp: process protocol version args first
Detection of protocol version is in the previous patch implemented in
the add_target() function, which is called when adding the -H command
line argument. That means that if a protocal version argument (-4, -6)
is added after the -H then the protocol version might be incorrectly
set.

This patch ensures that we first process the protocol version arguments,
and then we process the rest of the arguments.

Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-07 09:51:21 +00:00
Jacob Hansen
8edac9421f check_icmp: Automatically detect IP protocol
This patch automatically detects whether the protocol version is IPv4 or
IPv6

All credits to: https://github.com/ghciv6

Signed-off-by: Jacob Hansen <jhansen@op5.com>
2018-12-07 09:51:21 +00:00
Lars Michelsen
248bebb037 Fixed parameter handling after 01efbb2183 2018-12-07 09:51:21 +00:00
Lars Michelsen
fd6dc66653 check_icmp: Add IPv6 support
This commit adds IPv6 capabilities to check_icmp. It is now possible to
specify the address family using the arguments -4 (default) or -6.

To make the change possible we had to move the argument parsing previous
to creating the socket to be able to create it with the correct address
family.

This commit also fixes some gcc 4.9.2 compiler warnings. It has been
tested with several current linux distributions (debian, ubuntu, rh,
sles).

This commit fixes monitoring-plugins/monitoring-plugins#1291
2018-12-07 09:51:21 +00:00
Holger Weiss
89d00d1c00 Apply another spelling fix 2017-01-10 21:34:58 +01:00
Jan Wagner
dbb92c347e Spelling fixes suggested by lintian 2016-12-01 12:49:40 +01:00
Sven Nierlein
bebf1cd050 use unknown exit code for help/version in plugins-root as well
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-04 19:24:30 +02:00
Sven Nierlein
809508926f make use of MSG_CONFIRM optional
since MSG_CONFIRM is a linux thing and only available on linux kernels >= 2.3.15, see send(2)
2015-01-29 16:18:27 +01:00
Holger Weiss
ed9394880c check_icmp: Cast size_t values for printf(3)
Convert size_t values to unsigned long for printf(3) in order to
maximize portability.
2014-12-02 11:36:25 +01:00
Holger Weiss
9c289ec744 check_icmp: Fix a few type errors 2014-11-28 16:23:28 +01:00
Holger Weiss
8e5118e0cb Don't mix variable declarations and code
We still support pre-C99 compilers.
2014-11-28 16:23:28 +01:00
Matthieu Kermagoret
5265fabeb9 Use kernel reception time on ICMP packets to compute rtt.
This commit uses the SO_TIMESTAMP feature of setsockopt to fetch
kernel reception time of ICMP packets. This avoids invalid
computations of rtt on machines with heavy load and/or heavy
network traffic.
2014-11-28 16:23:27 +01:00
Jan Wagner
ba21e26443 check_icmp/check_dhcp: disable check, if we are root
As it is possible to use capabilities(7) on linux or solaris
privileges for example, it is not necessary in all cases to
have those binaries making use of setuid.
2014-07-06 13:29:24 +02:00
Holger Weiss
01e570f4a4 Capitalize "Monitoring Plugins"
"Monitoring Plugins" is a name.
2014-01-21 16:19:20 +01:00
Holger Weiss
c3e756a855 Capitalize "Monitoring" when it's the first word 2014-01-20 03:12:50 +01:00
Monitoring Plugins Development Team
63734f52ab Project rename initial commit.
This is an initial take at renaming the project to Monitoring Plugins.
It's not expected to be fully complete, and it is expected to break
things (The perl module for instance). More testing will be required
before this goes mainline.
2014-01-19 14:18:47 -05:00
Holger Weiss
317d2896dc check_icmp: Minor whitespace/indentation fixes 2013-09-04 22:28:50 +02:00
Holger Weiss
a480681cb7 check_icmp: Support "--help" and "--version"
Let check_icmp provide "--help" and "--version" flags (in addition to
"-h" and "-V"), just as the other plugins do.
2013-09-04 22:20:26 +02:00
Sebastian Harl
5ebe25fc24 check_host: Allocate a large-enough buffer for the host table.
When specifying a host-name on the command line, each of its IPs is added to
the host table (and each one is pinged). So, the buffer has to be large enough
to hold all of the respective host objects. (argc - 1) only fits hosts with a
single IP.

Thanks to Max Kosmach <max@tcen.ru> for reporting this in Debian bug #623702.
2011-04-28 20:42:53 -04:00
Thomas Guyot-Sionnest
eaf3cb27f4 Add newline after "Usage:" in --help 2010-04-22 08:57:14 -04:00
Thomas Guyot-Sionnest
884aee0667 Standardize the extra-opts notes 2010-04-21 23:29:18 -04:00
Thomas Guyot-Sionnest
25d1ee331d Fix translations when extra-opts aren't enabled
Bug #2832884 reported problem with translations outputting pot file
headers. This is caused by "" matching the header of the translation
files.

This patch moves gettext macros inside utils macros and update some
french translations.
2010-04-14 08:33:06 -04:00
Thomas Guyot-Sionnest
9c1aa029c0 Set proper network byte order for icmp_id and icmp_seq in icmp packets 2009-10-15 22:12:32 -04:00
Thomas Guyot-Sionnest
c2d9c59dc9 Increment per-host sequence in check_icmp 2009-10-15 21:52:18 -04:00
Matthias Eble
5f67308451 Fixed error in rtt/rta calculation in case of system clock problems
Time differences are now set to 0 in case of backward timejumps so there are no wrap-around problems any more.
The RTA calculation hopefully gets a more accurate value in these cases also.
2009-06-14 23:31:29 +02:00
Holger Weiss
bc827c9083 Don't use the plain char type for data buffers
Buffers which are used for holding arbitrary data should be referenced
using pointers to void and accessed using pointers to unsigned char.

Signed-off-by: Holger Weiss <holger@zedat.fu-berlin.de>
2009-06-02 01:09:18 +02:00
Matthias Eble
0a5cd15e75 Fixed check_icmp compiler warnings by including float.h
Self defined DBL_MAX caused compiler warnings. Now float.h
which defines DBL_MAX is included.
2009-06-01 22:41:46 +02:00
Matthias Eble
1c55e7287a Fixed --help output for warn and critical thresholds (sf.net #2796624, debian #530553)
check_icmp wrongly calculated the current thresholds in --help output.
2009-06-01 22:21:59 +02:00
Thomas Guyot-Sionnest
6fbd14fea5 Removing CVS/SVN tags and replacing with git-based versioning
For contrib/, full tags have been imported from subversion


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2091 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-23 05:38:47 +00:00
Thomas Guyot-Sionnest
caa8bd6423 Bulk EOL cleanup
$ git diff --ignore-space-change|diffstat
 0 files changed


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2087 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-19 06:45:18 +00:00
Thomas Guyot-Sionnest
526c3ad7a7 check_icmp now reports min and max round trip time perfdata (Steve Rader)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2073 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-07 01:41:17 +00:00
Thomas Guyot-Sionnest
2367f82090 Typo in --help output
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2029 f882894a-f735-0410-b71e-b25c423dba1c
2008-08-08 02:08:08 +00:00
Matthias Eble
3c38fc752e -b option now specifies ICMP data bytes instead of packet size
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2027 f882894a-f735-0410-b71e-b25c423dba1c
2008-07-28 20:15:52 +00:00
Matthias Eble
c64070fd3f Add support for packet size modification (-b)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2026 f882894a-f735-0410-b71e-b25c423dba1c
2008-07-17 07:06:33 +00:00
Thomas Guyot-Sionnest
44f8455b2c Added support for --extra-opts in all C plugins (disabled by default, see configure --help)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1991 f882894a-f735-0410-b71e-b25c423dba1c
2008-05-07 10:02:42 +00:00
Thomas Guyot-Sionnest
767bf9a0f2 --help output cleanup (plus removal of spaces on blank lines)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1985 f882894a-f735-0410-b71e-b25c423dba1c
2008-04-29 09:01:31 +00:00
Thomas Guyot-Sionnest
edf361db3e Bump plugins-root/ to GPLv3
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1920 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-31 11:52:45 +00:00
Holger Weiss
be1ba84de5 Hide some debug output which was printed even without "-v" (under
certain circumstances).


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1897 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-08 02:06:35 +00:00
Holger Weiss
6a00f7ecdd Fix the handling of ICMP packets which are not echo replies (such as
destination unreachable messages) or which are not directed at us.


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1896 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-08 01:51:14 +00:00
Holger Weiss
5da79db21a Get rid of a cast which increases the required alignment.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1895 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-08 01:43:49 +00:00
Holger Weiss
aa215f26d9 Mark some constant strings "const".
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1894 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-08 01:40:21 +00:00