I enabled the new mk_sap.py plugin on one of my VMs (NAME=“openSUSE Leap” VERSION=“15.5”) to monitor the SAP-Instances running there.
Everything is running great but after some time I am seeing the following exception being thrown
# /etc/check_mk/lib/plugins/mk_sap.py
Traceback (most recent call last):
File "/etc/check_mk/lib/plugins/mk_sap.py", line 148, in <module>
states = ast.literal_eval(opened_file.read())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/ast.py", line 110, in literal_eval
return _convert(node_or_string)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/ast.py", line 99, in _convert
return dict(zip(map(_convert, node.keys),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/ast.py", line 109, in _convert
return _convert_signed_num(node)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/ast.py", line 83, in _convert_signed_num
return _convert_num(node)
^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/ast.py", line 74, in _convert_num
_raise_malformed_node(node)
File "/usr/lib64/python3.11/ast.py", line 71, in _raise_malformed_node
raise ValueError(msg + f': {node!r}')
ValueError: malformed node or string on line 1: <ast.Call object at 0x7f9401811d50>
Deleting the state file (/tmp/check_mk/sap.state) gets the plugin back to working as expected.
Warning: It is possible to crash the Python interpreter due to stack depth limitations in Python’s AST compiler.
It can raise ValueError, TypeError, SyntaxError, MemoryError and RecursionError depending on the malformed input.
Hi, yes this is a bug in mk_sap. Try the following change:
@@ -145,7 +145,7 @@
# Load the state file into memory
try:
with open(STATE_FILE) as opened_file:
- states = ast.literal_eval(opened_file.read())
+ states = eval(opened_file.read())
except IOError:
states = {}
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.