mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-06-08 16:26:23 -04:00
check_snmp: fix offset computation for INTEGER (#2190)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Spellcheck / codespell (push) Has been cancelled
Tests / Running unit and integrationt tests (push) Has been cancelled
Tests / Running rpm build test on almalinux:9 (push) Has been cancelled
Tests / Running rpm build test on fedora:latest (push) Has been cancelled
Tests / Running rpm build test on rockylinux:8 (push) Has been cancelled
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Spellcheck / codespell (push) Has been cancelled
Tests / Running unit and integrationt tests (push) Has been cancelled
Tests / Running rpm build test on almalinux:9 (push) Has been cancelled
Tests / Running rpm build test on fedora:latest (push) Has been cancelled
Tests / Running rpm build test on rockylinux:8 (push) Has been cancelled
This commit is contained in:
parent
fd42290d4a
commit
25329a9097
1 changed files with 7 additions and 5 deletions
|
|
@ -446,7 +446,8 @@ check_snmp_evaluation evaluate_single_unit(response_value response,
|
|||
long long treated_value = (long long)response.value.uIntVal;
|
||||
|
||||
if (eval_params.multiplier_set || eval_params.offset_set) {
|
||||
double processed = 0;
|
||||
double processed = (double)response.value.uIntVal;
|
||||
|
||||
if (eval_params.offset_set) {
|
||||
processed += eval_params.offset;
|
||||
}
|
||||
|
|
@ -480,15 +481,16 @@ check_snmp_evaluation evaluate_single_unit(response_value response,
|
|||
} break;
|
||||
case ASN_INTEGER: {
|
||||
if (eval_params.multiplier_set || eval_params.offset_set) {
|
||||
double processed = 0;
|
||||
if (eval_params.multiplier_set) {
|
||||
processed = (double)response.value.intVal * eval_params.multiplier;
|
||||
}
|
||||
double processed = (double)response.value.intVal;
|
||||
|
||||
if (eval_params.offset_set) {
|
||||
processed += eval_params.offset;
|
||||
}
|
||||
|
||||
if (eval_params.multiplier_set) {
|
||||
processed *= eval_params.multiplier;
|
||||
}
|
||||
|
||||
result_state.value.doubleVal = processed;
|
||||
|
||||
if (eval_params.calculate_rate && have_previous_state) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue