aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_snmp.c
AgeCommit message (Collapse)Author
2022-07-24check_snmp: Segfault if number of processed lines is greater than number of ↵Gravatar adrb
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 readableGravatar Ken D
2022-01-14Added option for null zero length string exit codesGravatar Ken D
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 -> authpasswdGravatar Lorenz Kästle
2021-11-19Revert "Fixed option description authpassword -> authpasswd + whitespaces"Gravatar Lorenz Kästle
This reverts commit b27e639725f680411aaa78dd9aa59cfff84ad0c5.
2021-11-19Fixed option description authpassword -> authpasswd + whitespacesGravatar Lorenz Kästle
2021-11-17check_snmp: fix performance thresholds when using multiple oidsGravatar Sven Nierlein
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/masterGravatar Sven Nierlein
check_snmp: put the "c" (to mark a counter) after the perfdata value
2018-01-19Update check_snmp.cGravatar Sven Nierlein
remove unnecessary brackets in help text
2018-01-19check_snmp: make calcualtion of timeout value in help output more clearGravatar Michael Kraus
2017-02-07check_snmp: put the "c" (to mark a counter) after the perfdata valueGravatar Gerhard Lausser
2016-11-08Revert "check_snmp: fix push request 1173 for SNMP responses without ↵Gravatar Sven Nierlein
datatype indicator" This reverts commit 3178c8c0ff18822a04fe01c749f3564887473eed.
2016-11-08check_snmp: fix push request 1173 for SNMP responses without datatype indicatorGravatar Thomas Kurschel
2016-11-07check_snmp.c - Added IPv6 supportGravatar abrist
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'Gravatar Holger Weiss
* 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 pluginsGravatar Sven Nierlein
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-04check_snmp.c: switched DEFAULT_TIMEOUT to DEFAULT_SOCKET_TIMEOUT (provided ↵Gravatar Oliver Skibbe
by utils.h), already used by help description, see issue #1318
2015-10-02check_snmp: small improvement by anonymous submissionGravatar Jan Wagner
- 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_snmpGravatar Johannes Engel
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 dataGravatar Andreas Seemueller
2014-04-24check_snmp: Handle SNMPv3 noAuthNoPriv properlyGravatar Anton Lofgren
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_snmpGravatar Stephane Lapie
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'Gravatar Thomas Guyot-Sionnest
2014-01-21plugins/*.c: Alterations for timeout messages.Gravatar Spenser Reinhardt
.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 wordGravatar Holger Weiss
2014-01-19Project rename initial commit.Gravatar Monitoring Plugins Development Team
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 snmpgetGravatar Sven Nierlein
2013-09-05check_snmp: Initialize size_t value to 0, not NULLGravatar Holger Weiss
2013-08-27check_snmp: Fix --help segfaultGravatar Holger Weiss
2013-08-27Merge branch 'master' of https://github.com/ozamosi/nagios-pluginsGravatar Holger Weiss
* '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 thresholdsGravatar Holger Weiss
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" optionGravatar Holger Weiss
... and apply two small cosmetic changes to check_snmp.c. Closes #59.
2013-08-18added --offset option to allow adjustment of sensor dataGravatar Simon Kainz
2013-08-18check_snmp: Allocate space for the new -Le optionGravatar Holger Weiss
Closes #41.
2013-08-18Add -Le option to snmpcmd to avoid error message of 'No Log Handling Enabled...'Gravatar Mark Keisler
2013-01-29check_snmp: Close potential for using uninitialized memoryGravatar Robin Sonefors
This was reported by clang, and in order for it to understand attributes properly, I had to modify the macro that checks for non-gcc compilers. Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>
2013-01-29check_snmp: Dynamically grow all data structuresGravatar Robin Sonefors
Before this patch, there was a constant, MAX_OIDS, that determined the amount of slots most (but not all - see labels) array data structures would have. It was set to 8. Some users would like to use more than that, but rather than bumping the constant, let's use the same type of logic we already use for labels - grow the space 8 slots at a time. This will allow us to potentially support an infinite amount of oids - or at least as many as the packetsize on the SNMP server allows, which is usually significantly smaller than infinity, yet often larger than 8. Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>
2013-01-23check_snmp: Don't thrash memory when using multiple label/unit argumentGravatar Robin Sonefors
The memory allocation mixed up number of bytes with number of pointers, meaning as soon as we'd reach (on 64 bit systems) the second argument, we'd start writing it outside of our allocated memory. Normally, this isn't too visible, but as soon as you (again, on my 64 bit system) reach argument number 8, you get a segfault. It is easily reproducible with: check_snmp -o '' -l '' -o '' -l '' -o '' -l '' -o '' -l '' \ -o '' -l '' -o '' -l '' -o '' -l '' -o '' -l '' This patch allocates the proper amount of memory, to fix the issue. Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>
2012-11-02plugins/check_snmp: Show snmp error when we fail to parse its outputGravatar Andreas Ericsson
Dying without a hint of what went wrong is just plain annoying. With this patch we at least get a hint. While at it, we fix the string offset so the output we're interested in doesn't keep the equal sign that snmpget prints. Signed-off-by: Andreas Ericsson <ae@op5.se>
2012-11-02Make check_snmp backwards compatible in how it parses thresholdsGravatar Andreas Ericsson
Once upon a time, check_snmp used to accept inverse ranges in the format of '2:1' to mean "alert if value is inside this range". Since commit 7cb3ae09334796f3b54e4e6438e38c2cc679b360, ranges such as those have instead triggered the error "Range format incorrect" and resulted in an UNKNOWN warning state. This patch attempts to fix the situation so that the old-style ranges continues to mean exactly what the once did and people with lots of snmp checks can avoid a bazillion false positives from their environments. Signed-off-by: Andreas Ericsson <ae@op5.se>
2012-06-29Die when asprintf failsGravatar Anders Kaseorg
Fixes many instances of warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-06-27check_snmp: use single quotes for perf data labelsGravatar Sven Nierlein
2012-06-26Fix performance data label containing spaces in check_snmp (Jochen Bern)Gravatar Sven Nierlein
Add --perf-oids option for check_snmp to retain optional 1.4.14 compatibility
2012-02-24Cosmetic changeGravatar Holger Weiss
Replace all occurrences of "strstr(s, "c") == s" with "s[0] == 'c'".
2012-02-24Accept multiple labels specified with "-l"Gravatar Holger Weiss
Fix the code which accepts a comma-separated list of labels specified via the "-l" option. (Spotted by Oskar Liljeblad in Debian bug report #647020, forwarded by Jan Wagner.)
2010-11-30Revert "check_snmp now considers strings returned by SNMP that contain just"Gravatar Thomas Guyot-Sionnest
This reverts commit 896962a1ad1b7d7c75d42c565b06cc799feb0a7c. Conflicts: NEWS plugins/tests/check_snmp.t Notes: Reverting because I rebased a patch that was doing the same thing, plus fixing more related regressions, and both didn't work together. I kept the tests intact except for one that wouldn't pass on 1.4.14 either
2010-11-30check_snmp: Remove that is_numeric madnessGravatar Thomas Guyot-Sionnest
Original patch to make Timeticks works as in check_snmp v1.4.14, it turns out is_numeric isn't so useful and treating all types as numeric works best for backwards-compatibility. This is how it used to work in 1.4.14. As a special case, I also make calculate_rate look up for numeric values as it would otherwise return the last value instead.
2010-11-15check_snmp now considers strings returned by SNMP that contain justGravatar nagios
numbers (according to strtod) to be a numeric value for threshold and performance data
2010-07-09Fix --help output when MAX_OIDS is altered.Gravatar Thomas Guyot-Sionnest
2010-06-30Corrected rate_multiplier calculationGravatar tonvoon