summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
AgeCommit message (Collapse)AuthorFilesLines
2025-09-08check_snmp: refactoring + fixesLorenz Kästle1-415/+363
This commit moves the state retention logic to check_snmp as it is only used there and I do not want it to be used at all, so it doesn't get a place in the lib. Otherwise this adapts tests and fixes the rate computing in the refactored version of check_snmp. Also fixes some bugs detected with the tests
2025-09-01check_snmp: improve string quoting in resultLorenz Kästle1-1/+16
2025-08-30check_snmp: Small improvements + fix dereference bugLorenz Kästle1-3/+4
2025-08-30check_snmp: Fix number processing (offset + multiplier)Lorenz Kästle1-13/+58
2025-08-30check_snmp: implement output format settingLorenz Kästle1-15/+43
2025-08-29check_snmp: Make linter happyLorenz Kästle1-22/+28
2025-08-29check_snmp: Remove options description for input delimiterLorenz Kästle1-6/+0
2025-08-28check_snmp: fix DES availability detection(?)Lorenz Kästle1-3/+3
2025-08-28check_snmp: formattingLorenz Kästle1-2/+2
2025-08-28check_snmp: Test for availability of DES privacy protocolLorenz Kästle1-3/+18
2025-08-27check_snmp: use snmp v2c if community is givenLorenz Kästle1-0/+8
2025-08-27Fix one more typoLorenz Kästle1-1/+1
2025-08-27check_snmp: fix typosLorenz Kästle1-6/+6
2025-08-27check_snmp: declare internal functions staticLorenz Kästle1-2/+2
2025-08-27check_snmp: remove leftover multiply functionLorenz Kästle1-48/+0
2025-08-27check_snmp: Improve error handlingLorenz Kästle1-6/+15
2025-08-27check_snmp: rebuild threshold parsingLorenz Kästle1-18/+8
2025-08-25rebuild check_snmpLorenz Kästle1-926/+728
2024-10-31check_snmp: style + linter fixesRincewindsHat1-26/+30
2024-10-31check_snmp: update copyrightRincewindsHat1-2/+2
2024-10-31check_snmp: clang-formatRincewindsHat1-627/+586
2024-09-27check_snmp: Remove unused PP-macrosRincewindsHat1-2/+0
2024-09-27check_snmp: Declare most variables as staticRincewindsHat1-78/+78
2024-05-21Fix typosRincewindsHat1-2/+2
2024-05-21Add more documentation to the help page of check_snmp regarding ↵RincewindsHat1-4/+6
authentication and privacy options
2023-12-29check_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-18Fixes for WaddressRincewindsHat1-3/+5
* check_snmp: Fix string comparison
2023-04-18Fixes for -Wimplicit-fallthroughRincewindsHat1-0/+1
2023-04-14Fix a lot of typos reported by codespellJan Wagner1-1/+1
2023-03-27simplify codeSven 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 readableKen 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