Wessley.Hutton
2018-10-23 09:33:06 UTC
Hello
I can't get the ignored_services request to the WATO API to work.
I have configure an ignored service in WATO and then I use get rule set via the API to get the configuration format, and I get a configuration input file to use with Curl like :-
request={
'ruleset_name':'ignored_services',
'ruleset': {
'': [
{'conditions': {
'negate': False,
'host_specs': ['pcr-b2024-1'],
'service_specs': [u'Interface 16 Optical'],
'host_tags': []},
'options': {}}
]
}
}
When I use the API call to set this I get the following error message :-
{"result": "Unhandled exception: Traceback (most recent call last):\n File \"/omd/sites/test/share/check_mk/web/htdocs/webapi.py\", line 251, in page_api\n action_resp
onse = api_actions[action][\"handler\"](request_object)\n File \"/omd/sites/test/share/check_mk/web/plugins/webapi/webapi.py\", line 640, in _set\n value = rule[\"valu
e\"]\nKeyError: 'value'\n", "result_code": 1}
And looking around line 640 in webapi.py :-
for rule in rules:
value = rule["value"]
try:
rule_vs.validate_datatype(value, "test_value")
rule_vs.validate_value(value, "test_value")
except MKException, e:
raise MKException("ERROR: %s. Affected Rule %r" % (str(e), rule))
This is implying to me that it is expecting a value configuration item and there isn't one. Looking at the other configurations I have found for setting rule sets via the API they all appear to have a value setting.
Is this a bug or am I doing something stupid ? I can get the ignored_checks API call to work but that has a value configuration item, the names of the checks to be ignored.
Cheers
Wessley
[cid:***@01D46ABB.C7D63580]
[cid:***@01D46ABB.C7D63580]
Wessley Hutton | Senior Systems Programmer, IT Service and Support
Information Technology
The Open University, Level 0 North, Berrill Building, Walton Hall, Milton Keynes, MK7 6AA
Tel: +44 (0) 1908 652728
[cid:***@01D46ABB.C7D63580]
-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority in relation to its secondary activity of credit broking.
I can't get the ignored_services request to the WATO API to work.
I have configure an ignored service in WATO and then I use get rule set via the API to get the configuration format, and I get a configuration input file to use with Curl like :-
request={
'ruleset_name':'ignored_services',
'ruleset': {
'': [
{'conditions': {
'negate': False,
'host_specs': ['pcr-b2024-1'],
'service_specs': [u'Interface 16 Optical'],
'host_tags': []},
'options': {}}
]
}
}
When I use the API call to set this I get the following error message :-
{"result": "Unhandled exception: Traceback (most recent call last):\n File \"/omd/sites/test/share/check_mk/web/htdocs/webapi.py\", line 251, in page_api\n action_resp
onse = api_actions[action][\"handler\"](request_object)\n File \"/omd/sites/test/share/check_mk/web/plugins/webapi/webapi.py\", line 640, in _set\n value = rule[\"valu
e\"]\nKeyError: 'value'\n", "result_code": 1}
And looking around line 640 in webapi.py :-
for rule in rules:
value = rule["value"]
try:
rule_vs.validate_datatype(value, "test_value")
rule_vs.validate_value(value, "test_value")
except MKException, e:
raise MKException("ERROR: %s. Affected Rule %r" % (str(e), rule))
This is implying to me that it is expecting a value configuration item and there isn't one. Looking at the other configurations I have found for setting rule sets via the API they all appear to have a value setting.
Is this a bug or am I doing something stupid ? I can get the ignored_checks API call to work but that has a value configuration item, the names of the checks to be ignored.
Cheers
Wessley
[cid:***@01D46ABB.C7D63580]
[cid:***@01D46ABB.C7D63580]
Wessley Hutton | Senior Systems Programmer, IT Service and Support
Information Technology
The Open University, Level 0 North, Berrill Building, Walton Hall, Milton Keynes, MK7 6AA
Tel: +44 (0) 1908 652728
[cid:***@01D46ABB.C7D63580]
-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority in relation to its secondary activity of credit broking.