summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
AgeCommit message (Collapse)AuthorFilesLines
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
2009-03-14Fixed passing of quotes in OID for check_snmp (#1985230 - Jan Wagner, patch ↵Ton Voon1-155/+140
by John Barbuto)
2009-02-24check_snmp long help missing retries entry (#2608223)Thomas Guyot-Sionnest1-0/+2
Fix for check_snmp long help, reported by Richard Edward Horner
2009-02-20Typo fixes (Jan Wagner - SF 1878971)Ton Voon1-3/+3
2008-12-23Allow privproto to be passed through check_snmp to snmpget. Defaults to DESTon Voon1-4/+13
for compatibility
2008-11-23Removing CVS/SVN tags and replacing with git-based versioningThomas Guyot-Sionnest1-6/+2
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-19Bulk EOL cleanupThomas Guyot-Sionnest1-19/+19
$ 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-07-09check_snmp now only prints perfdata for non numeric values (Joerg Linge ↵Matthias Eble1-7/+11
#1867716) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2021 f882894a-f735-0410-b71e-b25c423dba1c
2008-05-07Added support for --extra-opts in all C plugins (disabled by default, see ↵Thomas Guyot-Sionnest1-0/+7
configure --help) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1991 f882894a-f735-0410-b71e-b25c423dba1c
2008-04-27--help output cleanup (plus removal of spaces on blank lines)Thomas Guyot-Sionnest1-18/+21
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1984 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-31Bump plugin/ to GPLv3 (check_overcr to check_users)Thomas Guyot-Sionnest1-21/+18
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1917 f882894a-f735-0410-b71e-b25c423dba1c
2007-12-10Plenty of french translations (and a few fixes BTW)Thomas Guyot-Sionnest1-1/+1
- No more fuzzy french translations - Only (!) 355 strings to translate git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1859 f882894a-f735-0410-b71e-b25c423dba1c
2007-11-11Fix broken usage2 in check_snmp and check_clusterThomas Guyot-Sionnest1-2/+2
Fix check_cluster blocking some special characters for thresholds ("-", "@", "~") git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1827 f882894a-f735-0410-b71e-b25c423dba1c
2007-11-09Fix check_snmp buffer overflow (CVE-2007-5623)Thomas Guyot-Sionnest1-6/+10
This patch comes from the Gentoo Portage tree but I couldn't find the author. I sent an email and will give credits when I get an answer. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1814 f882894a-f735-0410-b71e-b25c423dba1c
2007-11-09Fix missing \n in --help outputThomas Guyot-Sionnest1-2/+2
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1812 f882894a-f735-0410-b71e-b25c423dba1c
2007-10-24Hide the SNMP community string (and v3 passwords) from error messagesHolger Weiss1-3/+10
(Bernhard Fischer on nagiosplug-devel@) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1809 f882894a-f735-0410-b71e-b25c423dba1c
2007-05-29check_snmp don't warn anymore if something is printed on stderrThomas Guyot-Sionnest1-2/+9
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1721 f882894a-f735-0410-b71e-b25c423dba1c