Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
|
|
* '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
|
|
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.
|
|
... and apply two small cosmetic changes to check_snmp.c.
Closes #59.
|
|
|
|
Closes #41.
|
|
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
|
|
Add --perf-oids option for check_snmp to retain optional 1.4.14 compatibility
|
|
Replace all occurrences of "strstr(s, "c") == s" with "s[0] == 'c'".
|
|
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.)
|
|
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
|
|
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.
|
|
numbers (according to strtod) to be a numeric value for threshold and
performance data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See http://nagiosplugin.org/c-api-private for more details on the API.
Also updated check_snmp -l option to change the perfdata label.
|
|
|
|
|
|
This one counts double quotes and backslashes so it should handle any
level of escaping.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
#2832451)
|
|
|
|
|
|
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.
|
|
|
|
Barbuto)
|
|
- Fix broken compilation caused by typo in command ending
- Remove extra whitespaces at EOL
- Fix invalid host test on Ubuntu Hardy (and possibly others)
|
|
|
|
by John Barbuto)
|
|
Fix for check_snmp long help, reported by Richard Edward Horner
|
|
|
|
for compatibility
|
|
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
|