Issues migrating working Windows VSCode robot.tasks to RobotMK in 2.2

CMK version: 2.2.0p14
CMK OS version: Debian 11
RobotMK extension version: 1.4.2, installed, enabled, activated

Client agent version: 2.2.0p14 with RobotMK plugin baked and installed
Client OS version: Debian 11

I realized I started to hijack another thread, so I created this one. I have a working tasks.robot suite on my Windows desktop in VSCode. When trying to port the suite over to CheckMK I’m running into issues.

The first issue was missing python modules. I found the list in the agent output when I did a Connection Test in the CMK UI. Are these requirements documented somewhere and I missed them? Once I installed the requested modules the second issue came to light.

Here is the test suite that works in VSCode but not RobotMK:

*** Settings ***
Documentation       Test local CheckMK Site login

Library             RPA.Browser.Selenium


*** Variables ***
${SERVER}               REDACTED
${BROWSER}              Firefox
${DELAY}                0
${VALID USER}           cmkadmin
${VALID PASSWORD}       REDACTED
${LOGIN URL}            http://${SERVER}/gates/check_mk/login.py
${WELCOME URL}          http://${SERVER}/gates/check_mk/index.py


*** Tasks ***
Test CheckMK site login
    Open CheckMK Site
    Login page should be open
    Input Username    ${VALID USER}
    Input Password    ${VALID PASSWORD}
    Submit Credentials
    Main dashboard should be open
    [Teardown]    Close The Browser


*** Keywords ***
Open CheckMK Site
    Open Browser    ${LOGIN URL}    ${BROWSER}
    Maximize Browser Window
    Set Selenium Speed    ${DELAY}
    Login Page Should Be Open

Login Page Should Be Open
    Title Should Be    Checkmk Local site gates

Go To Login Page
    Go To    ${LOGIN URL}
    Login Page Should Be Open

Input Username
    [Arguments]    ${username}
    Input Text    input_user    ${username}

Input Password
    [Arguments]    ${password}
    Input Text    input_pass    ${password}

Submit Credentials
    Click Button    Login

Main dashboard should be open
    Location Should Be    ${WELCOME URL}
    Title Should Be    Checkmk Local site gates

Close The Browser
    Close Browser

This is a proof of concept for a client wanting to use RobotMK to monitor their SAML-enabled web application.

As suggested by Simon in the other thread, here are the outputs of robotmk-runner.py and robotmk.py

root@REDACTED:/usr/lib/check_mk_agent/plugins# python3 robotmk.py
<<<robotmk:sep(0)>>>
{
  "runner": {
    "encoding": "zlib_codec",
    "robotmk_version": "v1.4.2",
    "id": "runner",
    "execution_mode": "agent_serial",
    "start_time": "2024-01-16T10:31:09.638401-06:00",
    "end_time": "2024-01-16T10:31:09.675339-06:00",
    "assigned_host": [
      "REDACTED"
    ],
    "runtime_total": 0.036938,
    "runtime_suites": 0.036289,
    "runtime_robotmk": 0.0006489999999999968,
    "selective_run": false,
    "cache_time": 120,
    "execution_interval": 60,
    "is_piggyback_result": false
  },
  "suites": [
    {
      "id": "test_checkmk",
      "cache_time": 120,
      "execution_interval": 60,
      "path": "test_checkmk",
      "tag": null,
      "start_time": "2024-01-16T10:31:09.638792-06:00",
      "htmllog": null,
      "xml": "eNrNV1tv4jgUfudXHEUrZeaB3EjCRYURnXZm0FJAgW41T5VJXIhw4sh2hjKr/e9rh8sUQrvQdqTlJfj4XL4cf+f45OLTY0LgB2Y8pmlbtw1LB5yGNIrTWVvPxUND/9SpXDA6pQJmOMUMCcraWlAI6oYFH0YrMacp1Iym4YD8Q+I0f/yobbVx1NYcy3Grll21/YlttWp2y2oavuvWPUcDlqG2JliONeDhHCdoC0bzNBmZ57HAEEsn3NYgRQlua1+lVw6f5zhcJAtpRnMWSrGZc2aSeGqGauc+WdwjiUGYBXhzpozuw43RgefqezrfXxmFhgooheJXvKrYhZyojSLizZ/AFSpCZ3GqqVTKbbuhrBfLjfYww+lOeyy1y7uXjC45Zmoj4TMQsdo5egi+W/MkDoJ/YNLWvnR7fa0zoLDAqyVlESxjMS8cg/7UsQ4PNE8j48KU7mUQxGadP/7uD7/2BnAb9P+5MJVkK78Mhnfj62An5QKJnMP6sQmqVkw8D9JxNcAEZVzRyTIs+fP986Cu48n45mL5NGM36DFO4p94awF3cRrRpVZGOhhOILgd/AdYz7brJbCOpYFZjj3GAsaY4DTOExhnGEfaLm1X1/3u9+eSdiKUuleGYvtHofQV5WAkWQ3jOc1JBJcYVCZfn4hGo1aOXn8a/Xwq1FxZDvtOHd9x3ocK758D3/a8cg6aR0+gl2a5gFuJVK1/EeGvbr93BbcvlNCJWBzfPZUNaywjxLnK6CGWUXc8vhsGV2/EU6tbZTze8ULJp0ksmyTDkey6MSL89UfiNk4Oe4MkHyLE51OKJLH4mhRTDPRNpPAa3qkH8ZlQjmEy37UnDcQqU5fGdTe4Gt4NtLL2Ge2/7tbrJ7X/Pc/bSoKrOIIVzSHBKG1VQP5KeLd3xPmlXne9Ml+92m9AeNAPzofq1xv+IdSGbf0fodasUgN1fcc6p4FWKl3CKQgsa4IuU3hAMcFRq/IbX1bNTvIZ0bBTTEuEhojsTUHrmenCVCqvyYtd8w+L0vck29ZFWQyLr/ErOew09/06TjH4lvzGXMSheltBBSIbIWSyB0szrciyHAZluEWcKUmnSwhMEF/wdaaKPG1MBZoVy+LxNMgL/l6csjt7y13A01xWT/NqHI+xS5K5lyXMGGX8hB4nrz1/1+Oug2AYaJ1rZQyyuT9I6oL+xule33z3YHBb0EsyyoT8fpKSKUNsBXow6hobUhvbcU/flg3c0CgneEDFF1UaBbIWyFpKCnmRt6jwoVcmDIV4isIFfEioLAOGQwkTZC0QIIiLj6qUBjTFldH3ybfhYNSdfFOi594vI7ksGm761klKpmE81cuKL79a0/gZZ0fkRvOoUK2q0SolFEU7BVXOB2qRPOlqJt9VouBHPO0rbK8Zc0eL9eF1/gWFQJYT",
      "end_time": "2024-01-16T10:31:09.675081-06:00",
      "attempts": 1,
      "max_executions": 1,
      "rc": 1,
      "status": "nonfatal"
    }
  ]
}

root@REDACTED:/usr/lib/check_mk_agent/plugins# python3 60/robotmk-runner.py -v
2024-01-16 10:31:57,733  RMKrunner [3718960]    INFO: ####################
2024-01-16 10:31:57,787  RMKrunner [3718960]    INFO:  =test_checkmkSuites to start: test_checkmk
2024-01-16 10:31:57,788  RMKrunner [3718960]    INFO: ~~~~ Suite ID: test_checkmk ~~~~
2024-01-16 10:31:57,788  RMKrunner [3718960]   DEBUG: Strategy: OS Python
2024-01-16 10:31:57,789  RMKrunner [3718960]    INFO:  test_checkmkStarting suite...
2024-01-16 10:31:57,789  RMKrunner [3718960]   DEBUG: Robot arguments: --outputdir /var/log/robotmk --console NONE --report NONE --output robotframework_test_checkmk_1705422717_attempt-1_output.xml --log robotframework_test_checkmk_1705422717_attempt-1_log.html /usr/lib/check_mk_agent/robot/test_checkmk
2024-01-16 10:31:57,825  RMKrunner [3718960]    INFO:  < RC: 1
2024-01-16 10:31:57,825  RMKrunner [3718960]   DEBUG: Suite test_checkmk ran for 0.04 seconds
2024-01-16 10:31:57,825  RMKrunner [3718960]    INFO: Final suite RC: 1
2024-01-16 10:31:57,826  RMKrunner [3718960]    INFO: Writing results to suite statefile /var/log/robotmk/robotmk_test_checkmk.json
2024-01-16 10:31:57,826  RMKrunner [3718960]    INFO: ... Quitting Runner, bye. ---
root@REDACTED:/usr/lib/check_mk_agent/plugins# python3 60/robotmk-runner.py
root@REDACTED:/usr/lib/check_mk_agent/plugins#

With things currently as they are, the CheckMK Discovery service for this client machine crashes. Before installing the suite, it was working fine. Here is the traceback:

File "/omd/sites/gates/lib/python3/cmk/base/cee/keepalive/checker.py", line 211, in _process_fetch_entry
    check_result = execute_check_discovery(
  File "/omd/sites/gates/lib/python3/cmk/base/agent_based/discovery/_discovery.py", line 119, in execute_check_discovery
    services = get_host_services(
  File "/omd/sites/gates/lib/python3/cmk/base/agent_based/discovery/autodiscovery.py", line 593, in get_host_services
    **_get_node_services(
  File "/omd/sites/gates/lib/python3/cmk/base/agent_based/discovery/autodiscovery.py", line 625, in _get_node_services
    service_result = analyse_discovered_services(
  File "/omd/sites/gates/lib/python3/cmk/base/agent_based/discovery/_discovered_services.py", line 43, in analyse_discovered_services
    discovered_services=_discover_services(
  File "/omd/sites/gates/lib/python3/cmk/base/agent_based/discovery/_discovered_services.py", line 151, in _discover_services
    {
  File "/omd/sites/gates/lib/python3/cmk/base/agent_based/discovery/_discovered_services.py", line 151, in <dictcomp>
    {
  File "/omd/sites/gates/lib/python3/cmk/base/agent_based/discovery/_discovered_services.py", line 304, in _discover_plugins_services
    yield from (
  File "/omd/sites/gates/lib/python3/cmk/base/agent_based/discovery/_discovered_services.py", line 304, in <genexpr>
    yield from (
  File "/omd/sites/gates/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 73, in filtered_generator
    for element in generator(*args, **kwargs):
  File "/omd/sites/gates/local/lib/python3/cmk/base/plugins/agent_based/robotmk.py", line 95, in discover_robotmk
    info_dict, params_dict = parse_robotmk(params, section)
  File "/omd/sites/gates/local/lib/python3/cmk/base/plugins/agent_based/robotmk.py", line 82, in parse_robotmk
    st_dict["suites"][idx]["parsed"] = parse_suite_xml(
  File "/omd/sites/gates/local/lib/python3/cmk/base/plugins/agent_based/robotmk.py", line 1116, in parse_suite_xml
    root_suite = RobotSuite(root_xml, 0, 0, None, None)
  File "/omd/sites/gates/local/lib/python3/cmk/base/plugins/agent_based/robotmk.py", line 1053, in __init__
    super(RobotSuite, self).__init__(xmlnode, lv_abs, lv_rel, parent)
  File "/omd/sites/gates/local/lib/python3/cmk/base/plugins/agent_based/robotmk.py", line 488, in __init__
    self.elapsed_time = self._get_node_elapsed_time()
  File "/omd/sites/gates/local/lib/python3/cmk/base/plugins/agent_based/robotmk.py", line 557, in _get_node_elapsed_time
    self.start_time = self.xmlnode.find("status").attrib["starttime"]

I now see that the Discovery Service crash is a bit of a mislead. The real issue was discovered after exfiltrating the HTML output file. The import I’m using is apparently wrong: Importing library 'RPA.Browser.Selenium' failed: ModuleNotFoundError: No module named 'RPA'

Trying to install the robotframework-browser library isn’t going well either. I can’t install nodejs currently since I don’t use snaps. I will look at this and try to rember to come back here to document for my future self as well as others.

Hi Brian,

Trying to install the robotframework-browser library isn’t going well either.

No need to do that. Just execute pip install rpaframework to use the RPA.Browser.Selenium module.
Best regards,
Simon

PS:

I can’t install nodejs currently since I don’t use snaps.

This is something we’re adressing in Robotmkv2 which is contained in the upcoming Checkmk 2.3.
RCC can help you to create suite-specific environments, including NodeJS. :+1:

1 Like