Skip to content

Commit

Permalink
Release-0.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmeggle committed Jan 6, 2021
2 parents be6391f + ad5da55 commit a137128
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
### Fixed

- When using a custom service prefix for discovery, the pattern `%SPACE%` can now
be used at the prefix end to prevent Multisite cropping the string. (Solves #69)

## [v0.1.7 - 2021-01-05]

### Fixed/Changed
Expand Down
46 changes: 42 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,55 @@ The manual step to update the submodule is:
git submodule update --init --recursive
```

## TODO
### Debugging the RobotMK check

`ipdb` is a great cmdline debugger for Python. In the following example it is shown how to execute the RobotMK check within the cmk context.
A breakpoint in line 120 is set with "b":

```
OMD[cmk]:~$ python -m ipdb bin/cmk -IIv test2Win10simdows
> /opt/omd/sites/cmk/bin/cmk(34)<module>()
33
---> 34 import os
35 import sys
ipdb> b /omd/sites/cmk/local/share/check_mk/checks/robotmk:120
Breakpoint 1 at /omd/sites/cmk/local/share/check_mk/checks/robotmk:120
ipdb> r
Discovering services on: test2Win10simdows
test2Win10simdows:
+ FETCHING DATA
[agent] Execute data source
[piggyback] Execute data source
No piggyback files for 'test2Win10simdows'. Skip processing.
No piggyback files for '192.168.116.8'. Skip processing.
+ EXECUTING DISCOVERY PLUGINS (1751)
ps.perf does not support discovery. Skipping it.
> /omd/sites/cmk/local/share/check_mk/checks/robotmk(120)inventory_robot()
119 def inventory_robot(robot_items):
1-> 120 robot_service_prefix = get_setting('robot_service_prefix',[])
121 for robot_item in robot_items:
```

## Next developments

See the [Github Issues](https://github.com/simonmeggle/robotmk/issues) page for a complete list of feature requests, known bugs etc.

Next development steps will be:

* Improve the Robot test scheduling/execution on the remote side. Fiddling with cache_time and a guessed maximum runtime of all tests in total is a compromise at best. I am planning to develop a "juggler" plugin mode, which allows to define an execution interval for each Robot test. Robot tests are started then as detached processes. The juggler always knows how many tests can be started at once.
* Feedback from customers has shown that there is a need for checking the check of Robotmk itself.
This means to monitor if the plugin writes spoolfiles in the proper interval. If not,
this is currently very hard to detect because only the MK discovery check warns that the
`<<<robotmk>>>` agent section is missing. This meta-process will be called `robotmk-master`.
Read more about this in [issue 59](https://github.com/simonmeggle/robotmk/issues/59)
* It is helpful to have also Robot Logs at hand when there is an alarm. It is planned
that the RobotMK plugin also collects the Robot HTML logs and transfers them to the
CMK server. HTML logs could also include (embedded?) screenshots, animated GIF screen-recordings etc.
The goal is to implement a service action button which guides you directly to the most
recent Robot Log. Read more about this idea in [issue #1](https://github.com/simonmeggle/robotmk/issues/1).
* Create a complete Docker-based test setup which covers all test scenarios. Why not test RobotMK's functionality with Robot/Selenium itself.
* Robot produces nice HTML reports. Why not transport them to the CheckMK server and store in a dedicated shared folder. Then link CheckMK Robot checks to the corresponding HTML reports.
* Create a Docker container to execute Robot tests also in Containers. Expand the agent plugin to trigger Robot containers with API calls to Kubernetes and Docker Swarm to distribute E2E tests.
* Create dynamic area-stacked performance graphs in the CheckMK grapher. (No, I won't do this for PNP4Nagios)
* Create dynamic area-stacked performance graphs in the CheckMK grapher. (No, I won't do this for PNP4Nagios...)

## Contributing

Expand Down
8 changes: 5 additions & 3 deletions checks/robotmk
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def inventory_robot(robot_items):
robot_service_prefix = get_setting('robot_service_prefix',[])
for robot_item in robot_items:
prefix = pattern_match(robot_service_prefix, robot_item.name, '')
item_name = "%s%s" % (prefix, robot_item.name)
prefix_subst = prefix.replace('%SPACE%', ' ')
item_name = "%s%s" % (prefix_subst, robot_item.name)
yield item_name, None
# uncomment instead of yield to debug this method
# print suite_name
Expand Down Expand Up @@ -665,8 +666,9 @@ def get_setting(setting, defaultvalue):
def strip_prefix(suitename):
robot_service_prefix = get_setting('robot_service_prefix',[])
prefix = pattern_match(robot_service_prefix, suitename, '')
if suitename.startswith(prefix):
return suitename[len(prefix):]
prefix_subst = prefix.replace('%SPACE%', ' ')
if suitename.startswith(prefix_subst):
return suitename[len(prefix_subst):]
else:
return suitename

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/robot/001/expected.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'inventory_items': ['Testsuite'],
},
'dl_0_prefix': {
'inventory_items': ['TESTPREFIXTestsuite'],
'inventory_items': ['TESTPREFIX Testsuite'],
},
},
'items' : {
Expand Down
1 change: 1 addition & 0 deletions test/test_robotmk_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_check_info(checks):
# Inventory test function
inventory_test_params = [
('001', 'dl_0', 0),
# Tests if %SPACE% gets appended as Whitespace to service prefix
('001', 'dl_0_prefix', 0),
('001', 'dl_1', 1),
('001', 'dl_2', 2),
Expand Down
4 changes: 2 additions & 2 deletions web/plugins/wato/check_parameters_robotmk.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ def _valuespec_inventory_robotmk_rules():
title=("Service name prefix"),
allow_empty=True,
size=25,
default_value="Robot ",
help=_("How Robot service names should start")
default_value="Robot%SPACE%",
help=_("How Robot service names should start. If there should be a whitespace between prefix and name, mask it with <tt>%SPACE%</tt>.")
),
]), #Tuple_elements
title=_("Service prefix for discovered Robot services"),
Expand Down

0 comments on commit a137128

Please sign in to comment.