diff options
| author | Sven Nierlein <sven@nierlein.de> | 2021-11-17 11:58:41 +0100 |
|---|---|---|
| committer | Sven Nierlein <sven@nierlein.org> | 2021-11-17 14:04:09 +0100 |
| commit | 024d268386353133af1a9ff5c0b5879397c19b1c (patch) | |
| tree | 285cae08903f564af57304df3344e35a2ccbb401 /lib | |
| parent | 3f9b22ab16b5a9b74d62d7fff9b6bf3a51ed93f7 (diff) | |
| download | monitoring-plugins-024d268386353133af1a9ff5c0b5879397c19b1c.tar.gz | |
check_snmp: fix performance thresholds when using multiple oids
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:~'
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils_base.c | 2 | ||||
| -rw-r--r-- | lib/utils_base.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/utils_base.c b/lib/utils_base.c index fd7058da..08fa215c 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c | |||
| @@ -128,6 +128,7 @@ range | |||
| 128 | temp_range->end = 0; | 128 | temp_range->end = 0; |
| 129 | temp_range->end_infinity = TRUE; | 129 | temp_range->end_infinity = TRUE; |
| 130 | temp_range->alert_on = OUTSIDE; | 130 | temp_range->alert_on = OUTSIDE; |
| 131 | temp_range->text = strdup(str); | ||
| 131 | 132 | ||
| 132 | if (str[0] == '@') { | 133 | if (str[0] == '@') { |
| 133 | temp_range->alert_on = INSIDE; | 134 | temp_range->alert_on = INSIDE; |
| @@ -706,4 +707,3 @@ void np_state_write_string(time_t data_time, char *data_string) { | |||
| 706 | 707 | ||
| 707 | np_free(temp_file); | 708 | np_free(temp_file); |
| 708 | } | 709 | } |
| 709 | |||
diff --git a/lib/utils_base.h b/lib/utils_base.h index d7e7dffa..9482f23b 100644 --- a/lib/utils_base.h +++ b/lib/utils_base.h | |||
| @@ -23,6 +23,7 @@ typedef struct range_struct { | |||
| 23 | double end; | 23 | double end; |
| 24 | int end_infinity; | 24 | int end_infinity; |
| 25 | int alert_on; /* OUTSIDE (default) or INSIDE */ | 25 | int alert_on; /* OUTSIDE (default) or INSIDE */ |
| 26 | char* text; /* original unparsed text input */ | ||
| 26 | } range; | 27 | } range; |
| 27 | 28 | ||
| 28 | typedef struct thresholds_struct { | 29 | typedef struct thresholds_struct { |
