summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
AgeCommit message (Collapse)AuthorFilesLines
2023-12-28check_snmp: Remove unused variableRincewindsHat1-4/+0
2023-10-19Fix fallout of the previous changesRincewindsHat1-2/+2
2023-10-19Fixes for -Wsign-compareRincewindsHat1-13/+18
2023-10-18check_snmp: Use C99 booleansRincewindsHat1-6/+6
2023-08-30Merge branch 'master' into compiler_warning_part_5Lorenz Kästle1-21/+42
2023-08-28Remove dead, commented codeLorenz Kästle1-9/+0
2023-08-27Implement option to ignore mib file parsing errorsRincewindsHat1-17/+47
2023-07-23Merge branch 'master' into compiler_warning_part_5Lorenz Kästle1-0/+1
2023-07-11Detect if fmtstr was set in edge casesLorenz Kästle1-2/+4
2023-04-17Fixes for WaddressRincewindsHat1-3/+5
* check_snmp: Fix string comparison
2023-04-17Fixes for -Wimplicit-fallthroughRincewindsHat1-0/+1
2023-04-14Fix a lot of typos reported by codespellrefs/pull/1864/headJan Wagner1-1/+1
2023-03-27simplify coderefs/pull/1850/headSven Nierlein1-4/+1
if statement is always true at this point, so remove it.
2023-03-15check_snmp: disable multiplier when unusedSven Nierlein1-4/+9
- 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-01-20fix check_snmp regex matchesSven Nierlein1-2/+21
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)* | ```
2022-12-22check_snmp: always apply format when applying multiplierSven Nierlein1-1/+5
2022-12-22add 'multiplier' to modify current valueWolfgang Nieder1-23/+61
2022-07-24check_snmp: Segfault if number of processed lines is greater than number of ↵adrb1-1/+1
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-01-14Updated int state to human readablerefs/pull/1496/headKen D1-1/+1
2022-01-14Added option for null zero length string exit codesKen D1-3/+27
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.
2021-11-19Fix option description authpassword -> authpasswdLorenz Kästle1-1/+1
2021-11-19Revert "Fixed option description authpassword -> authpasswd + whitespaces"Lorenz Kästle1-20/+20
This reverts commit b27e639725f680411aaa78dd9aa59cfff84ad0c5.
2021-11-19Fixed option description authpassword -> authpasswd + whitespacesLorenz Kästle1-20/+20
2021-11-17check_snmp: fix performance thresholds when using multiple oidsSven Nierlein1-2/+7
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-04-07Merge pull request #1465 from lausser/masterSven Nierlein1-2/+3
check_snmp: put the "c" (to mark a counter) after the perfdata value
2018-01-19Update check_snmp.crefs/pull/1527/headSven Nierlein1-1/+1
remove unnecessary brackets in help text
2018-01-19check_snmp: make calcualtion of timeout value in help output more clearMichael Kraus1-1/+2
2017-02-07check_snmp: put the "c" (to mark a counter) after the perfdata valuerefs/pull/1465/headGerhard Lausser1-2/+3
2016-11-07Revert "check_snmp: fix push request 1173 for SNMP responses without ↵Sven Nierlein1-1/+1
datatype indicator" This reverts commit 3178c8c0ff18822a04fe01c749f3564887473eed.
2016-11-07check_snmp: fix push request 1173 for SNMP responses without datatype indicatorThomas Kurschel1-1/+1
2016-11-07check_snmp.c - Added IPv6 supportabrist1-3/+13
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.
2015-10-08Merge branch 'maint'Holger Weiss1-2/+1
* 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-04use unknown exit code for help/version in pluginsSven Nierlein1-2/+2
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-04check_snmp.c: switched DEFAULT_TIMEOUT to DEFAULT_SOCKET_TIMEOUT (provided ↵Oliver Skibbe1-2/+1
by utils.h), already used by help description, see issue #1318
2015-10-02check_snmp: small improvement by anonymous submissionJan Wagner1-0/+3
- response should not start with the delimiter - OID response value taken into account Closes issue #1029 Closes push request #1173
2014-11-28Introduce support for SNMPv3 context in check_snmpJohannes Engel1-11/+31
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-28check_snmp: Add thresholds to performance dataAndreas Seemueller1-0/+12
2014-04-24check_snmp: Handle SNMPv3 noAuthNoPriv properlyAnton Lofgren1-4/+6
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-01-31Handle negative values properly with check_snmpStephane Lapie1-1/+1
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-21Merge branch 'rename'Thomas Guyot-Sionnest1-3/+3
2014-01-21plugins/*.c: Alterations for timeout messages.Spenser Reinhardt1-1/+1
.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-20Capitalize "Monitoring" when it's the first wordHolger Weiss1-1/+1
2014-01-19Project rename initial commit.Monitoring Plugins Development Team1-3/+3
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.
2013-09-12check_snmp: add timeout handler befor running snmpgetSven Nierlein1-0/+10
2013-09-04check_snmp: Initialize size_t value to 0, not NULLHolger Weiss1-1/+1
2013-08-27check_snmp: Fix --help segfaultHolger Weiss1-1/+1
2013-08-27Merge branch 'master' of https://github.com/ozamosi/nagios-pluginsHolger Weiss1-21/+61
* 'master' of https://github.com/ozamosi/nagios-plugins: check_snmp: Close potential for using uninitialized memory check_snmp: Dynamically grow all data structures Conflicts: plugins/check_snmp.c
2013-08-21check_snmp: Fix support for inverse thresholdsHolger Weiss1-5/+7
Commit bd782990566eec91b8312cfc2765a7e2bd9e67da reintroduced support for inverse threshold ranges such as "2:1", but it broke standard thresholds such as "1:2" (by converting this range into "1") or "1:" (by converting this range into "@:2"). This commit fixes those two bugs, plus an off-by-one error while computing the number of bytes to allocate when handling inverse thresholds (two additional bytes were allocated where three were required to hold '@' and ':' and '\0'). While at it, we also check whether malloc(3) succeeded.
2013-08-18NEWS: Mention the new "check_snmp --offset" optionHolger Weiss1-2/+2
... and apply two small cosmetic changes to check_snmp.c. Closes #59.
2013-08-18added --offset option to allow adjustment of sensor dataSimon Kainz1-1/+9