summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
AgeCommit message (Collapse)AuthorFilesLines
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
2013-08-18check_snmp: Allocate space for the new -Le optionHolger Weiss1-2/+2
Closes #41.
2013-08-18Add -Le option to snmpcmd to avoid error message of 'No Log Handling Enabled...'Mark Keisler1-13/+14
2013-01-29check_snmp: Close potential for using uninitialized memoryrefs/pull/37/headRobin Sonefors1-1/+2
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 structuresRobin Sonefors1-20/+59
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 argumentRobin Sonefors1-11/+11
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-03plugins/check_snmp: Show snmp error when we fail to parse its outputAndreas Ericsson1-2/+2
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-03Make check_snmp backwards compatible in how it parses thresholdsAndreas Ericsson1-0/+23
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 failsAnders Kaseorg1-17/+17
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-26check_snmp: use single quotes for perf data labelsSven Nierlein1-3/+3
2012-06-26Fix performance data label containing spaces in check_snmp (Jochen Bern)Sven Nierlein1-3/+23
Add --perf-oids option for check_snmp to retain optional 1.4.14 compatibility
2012-02-24Cosmetic changeHolger Weiss1-7/+7
Replace all occurrences of "strstr(s, "c") == s" with "s[0] == 'c'".
2012-02-24Accept multiple labels specified with "-l"Holger Weiss1-3/+3
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-12-01Revert "check_snmp now considers strings returned by SNMP that contain just"Thomas Guyot-Sionnest1-14/+0
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-12-01check_snmp: Remove that is_numeric madnessThomas Guyot-Sionnest1-8/+4
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 justnagios1-0/+14
numbers (according to strtod) to be a numeric value for threshold and performance data
2010-07-09Fix --help output when MAX_OIDS is altered.Thomas Guyot-Sionnest1-2/+2
2010-06-30Corrected rate_multiplier calculationtonvoon1-1/+1
2010-06-30Removed suffix of "-rate" and let user decide label via --labeltonvoon1-2/+0
2010-06-30Tests for --rate-multiplier optiontonvoon1-1/+1
2010-06-30Fixed rate-multiplier optionTon Voon1-4/+8
2010-06-23Added option to invert search resultstonvoon1-6/+14
2010-06-23Added state retention APIs. Implemented for check_snmp with --rate option.Ton Voon1-16/+157
See http://nagiosplugin.org/c-api-private for more details on the API. Also updated check_snmp -l option to change the perfdata label.
2010-04-22Add newline after "Usage:" in --helpThomas Guyot-Sionnest1-1/+1
2010-04-22Standardize the extra-opts notesThomas Guyot-Sionnest1-3/+0
2010-04-22Replace the lousy multiline parser with a robust one.Thomas Guyot-Sionnest1-8/+49
This one counts double quotes and backslashes so it should handle any level of escaping.
2010-04-22Attempt at fixing check_snmp multiline output:Thomas Guyot-Sionnest1-3/+17
This patch tries to detect and output nicely multi-line strings. This method is broken by design; only a count of double-quotes and escapes could work in every situation.
2010-04-14Fix translations when extra-opts aren't enabledThomas Guyot-Sionnest1-8/+8
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-03-31check_snmp: Update last patch to copy value verbatimThomas Guyot-Sionnest1-10/+6
Rework last patch, copying the converted portion of the string rather than re-converting it. This is safer for backwards-compatibility as the value is never modified.
2010-03-31check_snmp: Fix regression introduced in #1867716Thomas Guyot-Sionnest1-2/+10
Bug #1867716 fixed what it meant to fix: broken perfdata strings. Unfortunately some users relied on half-broken perfdata string where at least the first token was OK. This patch do a two-way conversion (string to double then back to string) instead and use the conversion result for the performance data. A possible caveat is that the string may change where it normally shouldn't but the result should be somewhat similar.
2009-10-22Fix usage of repeated -o options in check_snmpThomas Guyot-Sionnest1-1/+1
2009-08-05Fix segfault in check_snmp (definitive fix is still in the works - see bug ↵Thomas Guyot-Sionnest1-3/+5
#2832451)
2009-08-01Fix check_snmp passing single-quotes as -m argument when it should be emptyThomas Guyot-Sionnest1-3/+3
2009-07-31check_snmp: Add some verbose output and testsThomas Guyot-Sionnest1-2/+5
2009-05-28check_snmp: Make use of standard threshold functionsThomas Guyot-Sionnest1-197/+53
This patch makes use of standard threshold functions. This allows using doubles as thresholds. Since SNMP supports only integers, double precision numbers are only printed when parsed from a STRING type. In addition, support for printing properly Timeticks type has been added, and the code has been thoroughly cleaned.
2009-05-27Fix whitespaces in check_snmpThomas Guyot-Sionnest1-73/+73
2009-03-18check_snmp: Fix potential buffer overflow - enforce MAX_OIDS limit (John A. ↵Thomas Guyot-Sionnest1-2/+1
Barbuto)
2009-03-16check_snmp fixes:Thomas Guyot-Sionnest1-5/+5
- Fix broken compilation caused by typo in command ending - Remove extra whitespaces at EOL - Fix invalid host test on Ubuntu Hardy (and possibly others)
2009-03-14Ignore stderr messages unless return code is non-zero or there is no outputTon Voon1-12/+20