Robotmk v2 quick start
Integrate the first RobotFramework test with Robotmk v2 in Checkmk step by step.
This step-by-step guide will help you get started with synthetic monitoring with the new version of Robotmk, which is integrated in Checkmk 2.3.
Prerequisites
- Windows-VM
- Internet access (needed by
rcc
to download the installation packages) - 8 GB RAM
- 4, better 8 CPUs (don’t even try with only 2 CPUs; it won’t work)
- basic monitoring by checkmk (“Vanilla”-Agent)
- Internet access (needed by
- Checkmk 2.3 on a Linux server
Windows test client
Download the RCC binary
The Checkmk agent, which we will install soon, will include the
rcc.exe
binary. You can therefore skip this step here if you want to integrate the robot into Checkmk immediately (i.e. without prior testing).
I have got into the habit of creating abin
directory in the user profile and putting the binary there like this:c:\Users\simonmeggle\bin\rcc.exe
For a prior test or to set up a development host, you will need to obtain the RCC binary yourself. Download it here (version v17.18 is the current one at the time of writing) and save it to a location of your choice.
Now add this folder to the user environment variable %PATH%
:
Open a new CMD and test whether you can now execute rcc
from any location:
Download of the minimal example
Now it’s time to download the repo with the robot suite that we want to integrate into Checkmk.
I have created the repository https://github.com/elabit/robotmk-examples especially for example suites. It is best to save it in your bookmarks.
Creating the environment for the web test
web/cmk_synthetic_web
takes a few minutes (Python packages, NodeJS, …).
If you want to start an absolute minimal example, you can alternatively use the robotminimal
from the demo repo.
In this case, nothing else is installed apart from Robot Framework.
Unzip the file master.zip
and save the subfolder web/cmk_synthetic_web
in the folder C:\robots\
. This folder serves as the so-called base directory for all robot suites.
Manual execution of the robot with RCC
Please note that we have not yet installed any software. The hour of RCC is about to strike!
Open a CMD and change to the folder C:\robots\cmk_synthetic_web
you just copied.
I will now explain a few commands in more detail, as they are important to understand:
where python
: Do we have Python available?
Thewhere
command is the equivalent of the Linux commandwhich
and attempts to find the command passed as an argument via the%PATH%
variable.
The%PATH%
variable usually consists of a whole series of search paths separated by semicolons. Windows searches for the specified programme in exactly this sequence of paths. With this test, I would like to find out whether Python is already installed on the system - and if so, where.
There will probably be no output at all on your system. On the Windows shown in the video, only “pyenv” is displayed. (We don’t need to go into this any further - there is no Python interpreter, period).rcc task shell
: The fastest way into an RCC environment.
This command startsrcc
with the instruction to search for the filerobot.yaml
in the current directory. From this, rcc is only interested in a single line: the one that refers to the fileconda.yaml
(usually in the same directory).
Ifrcc
finds it, the tool now starts to build a completely isolated environment; it contains everything our web test needs: Python (+packages), NodeJS (+packages), and three web browsers (Firefox, Chromium, Webkit).where python
: This time the command returns the path to the Python interpreter in the newly created environment.where robot
: NodeJS is also installed and is found via%PATH%
. (Isn’t that cool? π)robot tests.robot
: Robot Framework also comes with a command line tool calledrobot
, and this is also found in the search path.
To start the web test from this environment, it is sufficient to enter the name of the .robot file in the command. This starts the web browser in the foreground and Robot Framework performs a short Google search.
The execution of this test including the browser is completely based on an RCC environment! We have not installed any software beforehand!
This section has provided the proof: the robot can be started via RCC. β
In the next section we will now turn to the integration in Checkmk.
Checkmk server
Not much has happened on the Checkmk server (v2.3) so far: the Windows host is currently only monitored with a vanilla CMK agent:
Configuring the bakery
The Robotmk scheduler, which will later execute the robot tests on the Windows client, can be completely configured via the bakery rule “Robotmk Scheduler (Windows)”:
Explanations / values of the individual fields:
No | Description | Value |
---|---|---|
1. | The base directory where we had placed the sample suite. | C:\robots |
2. | The first (and only) parallel execution group. | |
3. | Sequential executions of Robot Framework suites are possible per execution group. | |
4. | Execution interval of the group | 3 |
5. | The name of the application to be tested | GoogleSearch |
6. | The path to the Robot Framework suite is specified relative to the base directory. | cmk_synthetic_web\tests.robot |
7. | This timeout determines how much time the suite receives from the scheduler for execution. It is then terminated. | 1 |
8. | Relative path (like 6.) to robot.yaml (central config file for RCC, contains reference to conda.yaml ) | cmk_synthetic_web\robot.yaml |
9. | Timeout for building the environment. | 10 |
At the bottom, the rule is restricted to the host windows
:
Then save the rule.
Bake agents
Now switch to the Agent Bakery…
…and bake a new installation agent:
As soon as the creation of the agent installer is finished, you will see a new line with the host to which you have restricted the rule (windows
) on the far right. Download the MSI package from here.
Discovery of the services
The first service that can be discovered immediately after deployment is the “Scheduler Status” service:
It monitors the Robotmk scheduler, which runs permanently alongside the agent as an “Extension” agent.
The scheduler runs through two phases after the agent is started:
- Phase 1: Sequential building of all RCC environments
- Phase 2: Scheduling of the plans (=configured Robot Framework suites) at the configured interval.
It may take a few minutes for the environment to be built in the background by the scheduler.
You can see when it is finished by the fact that the output of the scheduler service changes:
After the first execution of the suite took has been done in the background (=“headless”), two further services can be discovered:
- Plan Service: Similar to the “Scheduler Status” service, this is also a service aimed at administrators that alarms, for example, when results are too old (=the suite is no longer executed)
- Test Service: Aimed at application managers. Represents the status (PASS/FAIL) of the test from the point of view of Robot Framework.
Checklist
This checklist summarises all the steps in a nutshell:
- β Download and unpack the example repo
- β Save the robot suite in the base directory
C:\robots\
- β The Bakery rule in Checkmk requires at least these settings:
- β Base directory (e.g.
C:\robots\
) - β Execution interval of the group
- β Application name
- β (relative) path to the suite file/directory
- β (relative) path to the
robot.yaml
- β Base directory (e.g.
- β Baking / Deploying / Installing the agent
- β Discovery
(If everything worked out, this would be a great time to star ⭐ the project on Github, right? 😄 )
Star
Summary
With these few steps you have integrated your first Robot Framework-based web test (based on Playwright, by the way) into Checkmk.
Here are a few tips for your next steps:
- Explore the monitoring rule “Robotmk tests”, with which you can monitor the discovered test runtime and also the keywords contained in the test for their runtime.
- Install and open Visual Studio Code. Start an RCC shell in the suite folder and run
code .
. This opens the IDE directly in the RCC environment. Here you can view the robot suite and experiment a little.
Have fun with Robotmk!