Skip to content

Commit bcbf69e

Browse files
committed
Merge branch 'develop'
2 parents 48ae893 + 4a87980 commit bcbf69e

File tree

7 files changed

+52
-35
lines changed

7 files changed

+52
-35
lines changed

.vscode/v1/launch.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,34 @@
4545
// allow to inspect also foreign code
4646
"justMyCode": false
4747
},
48+
{
49+
"name": "devc V1.6 inventory localhost",
50+
"type": "python",
51+
"request": "launch",
52+
"program": "/omd/sites/cmk/bin/cmk",
53+
"args": [
54+
"-IIv",
55+
"localhost"
56+
],
57+
"console": "integratedTerminal",
58+
"python": "/omd/sites/cmk/bin/python",
59+
// allow to inspect also foreign code
60+
"justMyCode": false
61+
},
62+
{
63+
"name": "devc V1.6 check localhost",
64+
"type": "python",
65+
"request": "launch",
66+
"program": "/omd/sites/cmk/bin/cmk",
67+
"args": [
68+
"-vv",
69+
"localhost"
70+
],
71+
"console": "integratedTerminal",
72+
"python": "/omd/sites/cmk/bin/python",
73+
// allow to inspect also foreign code
74+
"justMyCode": false
75+
},
4876
{
4977
"name": "Python: Current File",
5078
"type": "python",

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 1.2.3 - 2021-11-29
9+
10+
### Fixed
11+
12+
* Check: If results are too old, the check now sets the services to stale (= they
13+
keep their state, but appear faded), whereas the Robotmk service turns into
14+
CRITICAL.
15+
16+
817
## 1.2.2 - 2021-11-04
918

1019
### Fixed

agents_plugins/robotmk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
local_tz = datetime.utcnow().astimezone().tzinfo
5151

52-
ROBOTMK_VERSION = 'v1.2.2'
52+
ROBOTMK_VERSION = 'v1.2.3'
5353

5454
class RMKConfig():
5555
_PRESERVED_WORDS = [

bakery/v1/robotmk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
1919
# Boston, MA 02110-1301 USA.
2020

21-
ROBOTMK_VERSION = 'v1.2.2'
21+
ROBOTMK_VERSION = 'v1.2.3'
2222

2323
import cmk.utils.paths
2424
import os

bakery/v2/robotmk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
1919
# Boston, MA 02110-1301 USA.
2020

21-
ROBOTMK_VERSION = 'v1.2.2'
21+
ROBOTMK_VERSION = 'v1.2.3'
2222

2323
from typing import Iterable, TypedDict, List
2424
from pathlib import Path

checks/v1/robotmk

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ from collections import namedtuple
3434
iam = "robotmk"
3535
# DO NOT DELETE
3636
inventory_robotmk_rules = []
37-
ROBOTMK_VERSION = 'v1.2.2'
37+
ROBOTMK_VERSION = 'v1.2.3'
3838
DEFAULT_SVC_PREFIX = 'Robot Framework E2E $SUITEID$SPACE-$SPACE'
3939
HTML_LOG_DIR = "%s/%s" % (os.environ['OMD_ROOT'], 'local/share/addons/robotmk')
4040

@@ -336,27 +336,18 @@ def check_robot(item, checkgroup_parameters, parsed):
336336
return evaluate_robot_item(discovered_item,
337337
checkgroup_parameters)
338338
else:
339-
# Keeping the following only for recalling.
340-
# A stale result should not return anything here.
341-
# It's enough to have it alarmed by the Robotmk
342-
# stale monitoring check (see Ref. N2UC9N)
343-
pass
344-
# overdue_sec = round(
345-
# age.total_seconds() - root_suite['cache_time'],
346-
# 1)
347-
# return ignore_robot_item(root_suite, last_end,
348-
# overdue_sec)
339+
ignore_robot_item(root_suite, last_end, age)
349340

350341

351342

352-
def ignore_robot_item(root_suite, last_end, overdue_sec):
353-
# TODO: (Perhaps make this configurable (OK/UNKNOWN))
343+
def ignore_robot_item(root_suite, last_end, age):
344+
overdue_sec = round(age.total_seconds() - root_suite['cache_time'],1)
354345
last_end_fmt = last_end.strftime('%Y-%m-%d %H:%M:%S')
355346
out = "Result of suite '%s' is too old. " % root_suite['id'] + \
356347
"Last execution end: %s, " % last_end_fmt + \
357348
"overdue since %ss " % (overdue_sec) + \
358349
"(cache time: %ss)" % str(root_suite['cache_time'])
359-
return 3, out
350+
raise MKCounterWrapped(out)
360351

361352

362353
def evaluate_robot_item(robot_item, checkgroup_parameters):

checks/v2/robotmk.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from cmk.base.plugins.agent_based.agent_based_api.v1 import *
3636
from cmk.utils.exceptions import MKGeneralException
3737

38-
ROBOTMK_VERSION = 'v1.2.2'
38+
ROBOTMK_VERSION = 'v1.2.3'
3939
DEFAULT_SVC_PREFIX = 'Robot Framework E2E $SUITEID$SPACE-$SPACE'
4040
HTML_LOG_DIR = "%s/%s" % (os.environ['OMD_ROOT'], 'local/share/addons/robotmk')
4141

@@ -337,30 +337,19 @@ def check_robotmk(item, params, section):
337337
for i in evaluate_robot_item(discovered_item, params_dict):
338338
yield i
339339
else:
340-
# Keeping the following only for recalling....
341-
# A stale result should not return anything here.
342-
# It's enough to have it alarmed by the Robotmk
343-
# stale monitoring check (see Ref. N2UC9N)
344-
pass
345-
# overdue_sec = round(
346-
# age.total_seconds() - root_suite['cache_time'],
347-
# 1)
348-
# yield ignore_robot_item(root_suite, last_end,
349-
# overdue_sec)
350-
351-
# We should not come here. Item cannot be found in parsed data.
352-
# see PRO TIP: simple return if no data is found
353-
# http://bit.ly/3epEcf3
340+
ignore = ignore_robot_item(root_suite, last_end, age)
341+
yield ignore
342+
354343
return
355344

356-
def ignore_robot_item(root_suite, last_end, overdue_sec):
357-
# TODO: (Perhaps make this configurable (OK/UNKNOWN))
345+
def ignore_robot_item(root_suite, last_end, age):
346+
overdue_sec = round(age.total_seconds() - root_suite['cache_time'],1)
358347
last_end_fmt = last_end.strftime('%Y-%m-%d %H:%M:%S')
359348
out = "Result of suite '%s' is too old. " % root_suite['id'] + \
360349
"Last execution end: %s, " % last_end_fmt + \
361350
"overdue since %ss " % (overdue_sec) + \
362351
"(cache time: %ss)" % str(root_suite['cache_time'])
363-
return 3, out
352+
return IgnoreResults(out)
364353

365354

366355
def evaluate_robot_item(robot_item, params):

0 commit comments

Comments
 (0)