BUG: oracle_asm_diskgroups check --> Unbound variable error for 'dg_sizefactor'

CMK version: 2.2.0p23.cme
OS version: Red Hat Enterprise Linux Server release 7.9

Error message:
Exception: UnboundLocalError (cannot access local variable ‘dg_sizefactor’ where it is not associated with a value)

Traceback:

  File "/omd/sites/VCloud/lib/python3/cmk/base/agent_based/checking/_checking.py", line 413, in get_aggregated_result
    consume_check_results(
  File "/omd/sites/VCloud/lib/python3/cmk/base/api/agent_based/checking_classes.py", line 484, in consume_check_results
    for subr in subresults:
  File "/omd/sites/VCloud/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 93, in filtered_generator
    for element in generator(*args, **kwargs):
  File "/omd/sites/VCloud/lib/python3/cmk/base/plugins/agent_based/oracle_asm_diskgroup.py", line 501, in cluster_check_oracle_asm_diskgroup
    yield from check_oracle_asm_diskgroup(item, params, node_section)
  File "/omd/sites/VCloud/lib/python3/cmk/base/plugins/agent_based/oracle_asm_diskgroup.py", line 408, in check_oracle_asm_diskgroup
    total_mb = total_mb // dg_sizefactor

Output of “cmk --debug -vvn hostname”:

Trying to acquire lock on /omd/sites/VCloud/tmp/check_mk/counters/moncxdbp_RAC
Got lock on /omd/sites/VCloud/tmp/check_mk/counters/moncxdbp_RAC
value store: loading from disk
Releasing lock on /omd/sites/VCloud/tmp/check_mk/counters/moncxdbp_RAC
Released lock on /omd/sites/VCloud/tmp/check_mk/counters/moncxdbp_RAC
[cpu_tracking] Stop [7f76df053150 - Snapshot(process=posix.times_result(user=0.0, system=0.0, children_user=0.0, children_system=0.0, elapsed=0.0))]
Trying to acquire lock on /omd/sites/VCloud/var/check_mk/crashes/base/1d62f0ea-e448-11ee-88f3-2b5f9c05c3e4/crash.info
Got lock on /omd/sites/VCloud/var/check_mk/crashes/base/1d62f0ea-e448-11ee-88f3-2b5f9c05c3e4/crash.info
Releasing lock on /omd/sites/VCloud/var/check_mk/crashes/base/1d62f0ea-e448-11ee-88f3-2b5f9c05c3e4/crash.info
Released lock on /omd/sites/VCloud/var/check_mk/crashes/base/1d62f0ea-e448-11ee-88f3-2b5f9c05c3e4/crash.info
Traceback (most recent call last):
  File "/omd/sites/VCloud/bin/cmk", line 118, in <module>
    exit_status = modes.call("--check", None, opts, args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/VCloud/lib/python3/cmk/base/modes/__init__.py", line 68, in call
    return handler(*handler_args)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/VCloud/lib/python3/cmk/base/modes/check_mk.py", line 2003, in mode_check
    with error_handler:
  File "/omd/sites/VCloud/lib/python3/cmk/checkers/error_handling.py", line 59, in __exit__
    self._result = _handle_failure(
                   ^^^^^^^^^^^^^^^^
  File "/omd/sites/VCloud/lib/python3/cmk/checkers/error_handling.py", line 95, in _handle_failure
    raise exc
  File "/omd/sites/VCloud/lib/python3/cmk/base/modes/check_mk.py", line 2006, in mode_check
    check_result = checking.execute_checkmk_checks(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/VCloud/lib/python3/cmk/base/agent_based/checking/_checking.py", line 117, in execute_checkmk_checks
    service_results = check_host_services(
                      ^^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/VCloud/lib/python3/cmk/base/agent_based/checking/_checking.py", line 293, in check_host_services
    submittables = [
                   ^
  File "/omd/sites/VCloud/lib/python3/cmk/base/agent_based/checking/_checking.py", line 303, in <listcomp>
    else get_aggregated_result(
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/VCloud/lib/python3/cmk/base/agent_based/checking/_checking.py", line 413, in get_aggregated_result
    consume_check_results(
  File "/omd/sites/VCloud/lib/python3/cmk/base/api/agent_based/checking_classes.py", line 484, in consume_check_results
    for subr in subresults:
  File "/omd/sites/VCloud/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 93, in filtered_generator
    for element in generator(*args, **kwargs):
  File "/omd/sites/VCloud/lib/python3/cmk/base/plugins/agent_based/oracle_asm_diskgroup.py", line 501, in cluster_check_oracle_asm_diskgroup
    yield from check_oracle_asm_diskgroup(item, params, node_section)
  File "/omd/sites/VCloud/lib/python3/cmk/base/plugins/agent_based/oracle_asm_diskgroup.py", line 408, in check_oracle_asm_diskgroup
    total_mb = total_mb // dg_sizefactor
               ^^^^^^^^
UnboundLocalError: cannot access local variable 'dg_sizefactor' where it is not associated with a value
OMD[VCloud]:~$

Agent Output:

<<<oracle_asm_diskgroup:sep(124)>>>
MOUNTED|NORMAL|PRODARCHEXT|4096|4194304|204792|307188|290708|FG1|N|REGULAR|0|8640000|3
MOUNTED|NORMAL|PRODARCHEXT|4096|4194304|204792|307188|290708|FG2|N|REGULAR|0|8640000|3
MOUNTED|NORMAL|PRODDATAEXT|4096|4194304|204792|921564|311852|FG1|N|REGULAR|0|8640000|9
MOUNTED|NORMAL|PRODDATAEXT|4096|4194304|204792|921564|311852|FG2|N|REGULAR|0|8640000|9
MOUNTED|NORMAL|PRODTOPEXT|4096|4194304|0|51196|820|FG1|N|REGULAR|0|8640000|1
MOUNTED|NORMAL|PRODTOPEXT|4096|4194304|0|51196|820|FG2|N|REGULAR|0|8640000|1
MOUNTED|EXTEND|VOTINGEXT|4096|4194304|0|10236|9852|FG1|Y|REGULAR|0|8640000|1
MOUNTED|EXTEND|VOTINGEXT|4096|4194304|0|10236|9856|FG2|Y|REGULAR|0|8640000|1
MOUNTED|EXTEND|VOTINGEXT|4096|4194304|0|10236|9864|FG3|Y|REGULAR|0|8640000|1
MOUNTED|EXTEND|VOTINGEXT|4096|4194304|0|10236|9860|FG4|Y|REGULAR|0|8640000|1
MOUNTED|EXTEND|VOTINGEXT|4096|4194304|0|10236|9860|FG5|Y|REGULAR|0|8640000|1
MOUNTED|EXTEND|VOTINGEXT|4096|4194304|0|10236|9852|FG6|Y|REGULAR|0|8640000|1
MOUNTED|EXTEND|VOTINGEXT|4096|4194304|0|10240|10196|FG7|Y|QUORUM|0|8640000|1

I have tried the steps mentioned in,

but didn’t solve my issue.
Can someone please help me to resolve this issue?

Thank you,
Benson Thomas

Relative easy solution. Copy the “oracle_asm_diskgroup.py” to your “~/local/lib/check_mk/base/plugins/agent_based/” inside your site.
At line 295 where you see some variables filled with values you insert the line.

    dg_sizefactor = 1

Pay attention to the correct indentation and don’t use tabs.
The problem is that dg_sizefactor can be unbound with the local code. The is a “coding style” problem → if - elif without anything if nothing matches.

PS: changed the title to make the problem a little bit clearer

3 Likes

@andreas-doehler

Thank you for the support.
The provided suggestion worked for me.

Regards,
Benson Thomas
Systems Support

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.