kuhn-ruess / Checkmk-Checks

Checks and Stuff for Check_MK
MIT License
40 stars 22 forks source link

Cohesity Node Status: Error in Parse Function #83

Closed JF-JX closed 2 months ago

JF-JX commented 2 months ago

Error Message: "Parsing of section cohesity_node_status failed - please submit a crash report!"

Output of cmk --debug: Traceback (most recent call last): File "/omd/sites/mysite/bin/cmk", line 120, in exit_status = modes.call("--check", None, opts, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/lib/python3/cmk/base/modes/init.py", line 70, in call return handler(handler_args) ^^^^^^^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/lib/python3/cmk/base/modes/check_mk.py", line 2137, in mode_check with ( File "/omd/sites/mysite/lib/python3/cmk/base/errorhandling/_handler.py", line 66, in exit _handle_failure( ^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/lib/python3/cmk/base/errorhandling/_handler.py", line 103, in _handle_failure raise exc File "/omd/sites/mysite/lib/python3/cmk/base/modes/check_mk.py", line 2153, in mode_check checks_result = execute_checkmk_checks( ^^^^^^^^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/lib/python3/cmk/checkengine/checking/_checking.py", line 83, in execute_checkmk_checks service_results = list( ^^^^^ File "/omd/sites/mysite/lib/python3/cmk/checkengine/checking/_checking.py", line 216, in check_host_services yield plugin.function(host_name, service, providers=providers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/lib/python3/cmk/base/checkers.py", line 425, in check_function return get_aggregated_result( ^^^^^^^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/lib/python3/cmk/base/checkers.py", line 690, in get_aggregated_result section_kws, error_result = _get_monitoring_data_kwargs( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/lib/python3/cmk/base/checkers.py", line 611, in _get_monitoring_data_kwargs get_section_kwargs( File "/omd/sites/mysite/lib/python3/cmk/checkengine/sectionparserutils.py", line 42, in get_section_kwargs if (resolved := resolver.resolve(name)) is not None ^^^^^^^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/lib/python3/cmk/checkengine/sectionparser.py", line 181, in resolve parsing_result := self._parser.parse(producer_name, producer.parse_function) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/lib/python3/cmk/checkengine/sectionparser.py", line 92, in parse if (parsed := self._parse_raw_data(section_name, parse_function)) is None ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/lib/python3/cmk/checkengine/sectionparser.py", line 113, in _parse_raw_data return parse_function(list(raw_data)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/omd/sites/mysite/local/lib/python3/cmk/base/plugins/agent_based/cohesity_node_status.py", line 18, in parse_cohesity_node_status services = row[2:][0].split(',')


IndexError: list index out of range
Bastian-Kuhn commented 2 months ago

Hello,

That is not a bug in the Plugin, the exception is caused by missing data from the special agent. This can because of missing permissions or a wrong configuration. Worst case some changes in their API.

JF-JX commented 2 months ago

Hi Bastian, Permissions are correct. If I look in the output of cmk -d, I do get a lot of data back. But at first sight, this doesn't look right...every node appears twice: first line says "node-name-xy failed" second line says "node-name-xy ok" and appends all the node service names.

JF-JX commented 2 months ago

Wait no, thats actually fine. But I think the problem is that you do: services = (row[2:][0]).split(',') but there are some lines where no third element exists, which leads to the IndexError.

Bastian-Kuhn commented 2 months ago

Hi

Could you show some example output?

JF-JX commented 2 months ago

Sure, here's an example: <<>> myhost-cc123-node-3 failed myhost-cc123-node-3 ok aegis,alerts,apollo,athena,atom,bifrost,bifrost_broker,bridge,bridge_proxy,cohesity_ca,compass,eagle_agent,elrond,etl_server,gandalf,groot,heimdall,icebox,iris,iris_proxy,janus,keychain,librarian,logwatcher,magneto,newscribe,nexus,nexus_proxy,nfs_proxy,node_exporter,patch,pushclient,rtclient,smb2_proxy,smb_proxy,spire_agent,spire_server,stats,statscollector,storage_proxy,throttler,vault_proxy,yoda myhost-cc123-node-2 failed myhost-cc123-node-2 ok aegis,alerts,apollo,athena,atom,bifrost,bifrost_broker,bridge,bridge_proxy,cohesity_ca,compass,eagle_agent,elrond,etl_server,gandalf,groot,heimdall,icebox,iris,iris_proxy,janus,keychain,librarian,logwatcher,magneto,newscribe,nexus,nexus_proxy,nfs_proxy,node_exporter,patch,pushclient,rtclient,smb2_proxy,smb_proxy,spire_agent,spire_server,stats,statscollector,storage_proxy,throttler,vault_proxy,yoda myhost-cc123-node-4 failed myhost-cc123-node-4 ok aegis,alerts,apollo,athena,atom,bifrost,bifrost_broker,bridge,bridge_proxy,cohesity_ca,compass,eagle_agent,elrond,etl_server,gandalf,groot,heimdall,icebox,iris,iris_proxy,janus,keychain,librarian,logwatcher,magneto,newscribe,nexus,nexus_proxy,nfs_proxy,node_exporter,patch,pushclient,rtclient,smb2_proxy,smb_proxy,spire_agent,spire_server,stats,statscollector,storage_proxy,throttler,vault_proxy,yoda myhost-cc123-node-1 failed myhost-cc123-node-1 ok aegis,alerts,apollo,athena,atom,bifrost,bifrost_broker,bridge,bridge_proxy,cohesity_ca,compass,eagle_agent,elrond,etl_server,gandalf,groot,heimdall,icebox,iris,iris_proxy,janus,keychain,librarian,logwatcher,magneto,newscribe,nexus,nexus_proxy,nfs_proxy,node_exporter,patch,pushclient,rtclient,smb2_proxy,smb_proxy,spire_agent,spire_server,stats,statscollector,storage_proxy,throttler,vault_proxy,yoda myhost-cc456-node-1 failed myhost-cc456-node-1 ok aegis,alerts,apollo,athena,atom,bifrost,bifrost_broker,bridge,bridge_proxy,cohesity_ca,compass,eagle_agent,elrond,etl_server,gandalf,groot,heimdall,icebox,iris,iris_proxy,janus,keychain,librarian,logwatcher,magneto,newscribe,nexus,nexus_proxy,nfs_proxy,node_exporter,patch,pushclient,rtclient,smb2_proxy,smb_proxy,spire_agent,spire_server,stats,statscollector,storage_proxy,throttler,vault_proxy,yoda

:)

JF-JX commented 2 months ago

okay there are weird line breaks, the servicenames are in fact right after the "ok" ^^

Bastian-Kuhn commented 2 months ago

Can you test the new MKP if i fixed your problem?

JF-JX commented 2 months ago

Works now, thanks!

Bastian-Kuhn commented 2 months ago

My pleasure