Commit graph

182 commits

Author SHA1 Message Date
RincewindsHat
b6d920da55 check_snmp: style + linter fixes 2024-10-31 14:01:12 +01:00
RincewindsHat
04471ba48d check_snmp: update copyright 2024-10-31 13:56:28 +01:00
RincewindsHat
50f6ae2c64 check_snmp: clang-format 2024-10-31 13:56:00 +01:00
RincewindsHat
b1e96a3bf3 check_snmp: Remove unused PP-macros 2024-09-27 11:58:42 +02:00
RincewindsHat
3ba660889a check_snmp: Declare most variables as static 2024-09-27 11:57:38 +02:00
RincewindsHat
26a979284d Fix typos 2024-05-21 14:27:21 +02:00
RincewindsHat
c862f705f3 Add more documentation to the help page of check_snmp regarding authentication and privacy options 2024-05-21 13:59:45 +02:00
RincewindsHat
5275f81e38 check_snmp: Remove unused variable 2023-12-29 00:47:29 +01:00
RincewindsHat
81f3b41651 Fix fallout of the previous changes 2023-10-19 12:20:27 +02:00
RincewindsHat
07f9c438f3 Fixes for -Wsign-compare 2023-10-19 12:10:55 +02:00
RincewindsHat
d4539f8662 check_snmp: Use C99 booleans 2023-10-18 20:22:06 +02:00
Lorenz Kästle
aa76eece10
Merge branch 'master' into compiler_warning_part_5 2023-08-30 09:36:53 +02:00
Lorenz Kästle
9e32be80d6 Remove dead, commented code 2023-08-28 11:15:59 +02:00
RincewindsHat
90cb539595 Implement option to ignore mib file parsing errors 2023-08-27 23:13:17 +02:00
Lorenz Kästle
c47f44d897
Merge branch 'master' into compiler_warning_part_5 2023-07-23 22:19:34 +02:00
Lorenz Kästle
068c124f36 Detect if fmtstr was set in edge cases 2023-07-11 16:39:29 +02:00
RincewindsHat
6d341c40ab Fixes for Waddress
* check_snmp: Fix string comparison
2023-04-18 00:35:41 +02:00
RincewindsHat
f7687d47cb Fixes for -Wimplicit-fallthrough 2023-04-18 00:18:07 +02:00
Jan Wagner
0f3703e641 Fix a lot of typos reported by codespell 2023-04-14 18:35:00 +00:00
Sven Nierlein
6e64973a44 simplify code
if statement is always true at this point, so remove it.
2023-03-27 12:59:53 +02:00
Sven Nierlein
c874f950e8 check_snmp: disable multiplier when unused
- if no multiplier is set, simply return the given string. Otherwise we would strip off the unit.
 - if used, allocate new space to hold the result which might be larger than the initial input

Signed-off-by: Sven Nierlein <sven@consol.de>
2023-03-15 09:51:18 +01:00
Sven Nierlein
f4930aee28 fix check_snmp regex matches
the multiplier function always tried to extract a number, even if the result
is a string because of using a mib.

before:
```
./check_snmp -H hostname -P2c -c public -o IF-MIB::ifAdminStatus.11466 -vvv -r 0
/usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c [context] [authpriv] 10.0.13.11:161 IF-MIB::ifAdminStatus.11466
IF-MIB::ifAdminStatus.11466 = INTEGER: up(1)
Processing oid 1 (line 1)
  oidname: IF-MIB::ifAdminStatus.11466
  response:  = INTEGER: up(1)
SNMP OK - 0 | IF-MIB::ifAdminStatus.11466=0;;
```

the regexp 0 matches, even if the actual result is "up(1)".

after this patch:
```
./check_snmp -H hostname -P2c -c public -o IF-MIB::ifAdminStatus.11466 -vvv -r 0
/usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c [context] [authpriv] 10.0.13.11:161 IF-MIB::ifAdminStatus.11466
IF-MIB::ifAdminStatus.11466 = INTEGER: up(1)
Processing oid 1 (line 1)
  oidname: IF-MIB::ifAdminStatus.11466
  response:  = INTEGER: up(1)
SNMP CRITICAL - *up(1)* |
```
2023-01-20 08:57:56 +01:00
Sven Nierlein
9ba8f5ed66 check_snmp: always apply format when applying multiplier 2022-12-22 12:54:51 +01:00
Wolfgang Nieder
c35bf8966a add 'multiplier' to modify current value 2022-12-22 12:54:51 +01:00
adrb
9f2a9ca3d7
check_snmp: Segfault if number of processed lines is greater than number of thresholds
Segfault at line 489 if number of processed lines is greater than number (#1589) of thresholds

Co-authored-by: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
2022-07-24 16:44:16 +02:00
Ken D
69fed9d083 Updated int state to human readable 2022-01-14 15:52:00 +01:00
Ken D
a1f3289000 Added option for null zero length string exit codes
When using a large distributed network with the same group of checks used against a large number of devices, occationally there are missing cards in a few devices that are present in other devices. Rather than having a large number of unknown results, disable active checking on those large number of result or having to create a unique check configuration for those devices.

This option allows you to select an OK, WARNING, CRITICAL or UNKNOWN status while still retaining the default behavior when not present. This also allows a for the check to immediately start checks as intended should the hardware be added that the check is looking for.
2022-01-14 15:52:00 +01:00
Lorenz Kästle
c46447af65 Fix option description authpassword -> authpasswd 2021-11-19 09:30:20 +01:00
Lorenz Kästle
cf9dccbec2 Revert "Fixed option description authpassword -> authpasswd + whitespaces"
This reverts commit b27e639725.
2021-11-19 09:30:20 +01:00
Lorenz Kästle
a1fe4df6a3 Fixed option description authpassword -> authpasswd + whitespaces 2021-11-19 09:30:20 +01:00
Sven Nierlein
024d268386 check_snmp: fix performance thresholds when using multiple oids
when using check_snmp with multiple oids it simply printed the unparsed content
from -w/-c into the thresholds for each oid. So each oid contained the hole -w
from all oids.

./check_snmp ... -o iso.3.6.1.2.1.25.1.3.0,iso.3.6.1.2.1.25.1.5.0 -w '1,2' -c '3,4'

before:
  SNMP ... | HOST-RESOURCES-MIB::hrSystemInitialLoadDevice.0=393216;1,2;3,4 HOST-RESOURCES-MIB::hrSystemNumUsers.0=24;1,2;3,4

after:
  SNMP ... | HOST-RESOURCES-MIB::hrSystemInitialLoadDevice.0=393216;1;3 HOST-RESOURCES-MIB::hrSystemNumUsers.0=24;2;4

This also applies to fixed thresholds since check_snmp translates negative infinities from: '~:-1' to '@-1:~'
2021-11-17 14:04:09 +01:00
Sven Nierlein
de7effdf06
Merge pull request #1465 from lausser/master
check_snmp: put the "c" (to mark a counter) after the perfdata value
2021-04-07 17:12:38 +02:00
Sven Nierlein
b7de6ec8bd
Update check_snmp.c
remove unnecessary brackets in help text
2018-01-19 17:05:46 +01:00
Michael Kraus
9fa449119c check_snmp: make calcualtion of timeout value in help output more clear 2018-01-19 15:13:12 +01:00
Gerhard Lausser
c85281d25b check_snmp: put the "c" (to mark a counter) after the perfdata value 2017-02-07 14:15:47 +01:00
Sven Nierlein
d9999194e6 Revert "check_snmp: fix push request 1173 for SNMP responses without datatype indicator"
This reverts commit 3178c8c0ff.
2016-11-08 00:23:28 +01:00
Thomas Kurschel
3178c8c0ff check_snmp: fix push request 1173 for SNMP responses without datatype indicator 2016-11-08 00:11:04 +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
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
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
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
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
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
Anton Lofgren
4e0da0216d check_snmp: Handle SNMPv3 noAuthNoPriv properly
The SNMPv3 noAuthNoPriv security level, somewhat unintuitively, requires
a security name to be passed along together with the request. Check_snmp
previously did not do this, causing snmpget to throw an error:

"External command error: No log handling enabled - turning on stderr
logging
snmpget: No securityName specified"

This patch fixes the issue by always providing the security name when
noAuthNoPriv is specified.

See also:
https:://bugs.op5.com/view.php?id=8385.

Signed-off-by: Anton Lofgren <alofgren@op5.com>
2014-04-24 08:49:54 +02:00
Stephane Lapie
35811848da Handle negative values properly with check_snmp
check_snmp becomes capable of evaluating negative values properly,
but it might be returning CRITICALs where it used to return OK and was ignored,
if a negative value turns out to actually be a valid value.
If negative values are valid, this can be worked around,
by adding "~:" to the warning/critical threshold : 100 -> ~:100
2014-01-31 00:49:18 -05:00
Thomas Guyot-Sionnest
11cf54ca78 Merge branch 'rename' 2014-01-21 07:59:07 -05:00
Spenser Reinhardt
212575b858 plugins/*.c: Alterations for timeout messages.
.c file changes for misleading timeout messages in help functions. Solution to pull request #1209 tracker by awiddersheim.

Files: plugins/check_apt.c, plugins/check_by_ssh.c, plugins/check_dbi.c, plugins/check_dig.c, plugins/check_disk.c, plugins/check_dns.c, plugins/check_game.c, plugins/check_http.c, plugins/check_ldap.c, plugins/check_ntp.c, plugins/check_ntp_peer.c, plugins/check_ntp_time.c, plugins/check_nwstat.c, plugins/check_overcr.c, plugins/check_pgsql.c, plugins/check_ping.c, plugins/check_procs.c, plugins/check_radius.c, plugins/check_real.c, plugins/check_smtp.c, plugins/check_snmp.c, plugins/check_ssh.c, plugins/check_tcp.c, plugins/check_time.c, plugins/check_ups.c, plugins/negate.c
2014-01-21 11:33:45 +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