CMK version : 1.6.0p9
OS version : CentOS 7
Error message : Expecting property name: line 1 column 2 (char 1)
Description of the problem : I’m trying to test the new HTTP-API, in combination with Rule Set commands. But this seems to be not working. Does anybody have experience with this?
Troublshoot steps:
- Get the needed information with get_ruleset
Command:
[vagrant@checkmk ~]$ curl localhost/test/check_mk/webapi.py?action=get_ruleset&_username=automation&_secret=4c550ece-c5eb-4456-b04a-b5fa4df4c18e&output_format=python" -d ‘request={“ruleset_name”:“checkgroup_parameters:filesystem”}’
Result:
{‘result’: {‘ruleset’: {‘’: [{‘condition’: {}, ‘value’: {‘levels’: (80.0, 90.0)}, ‘options’: {‘description’: u’Create rule after Curl command’}}]}, ‘configuration_hash’: ‘b4765a55eca77acc5b0a57e1d2ef9be4’}, ‘result_code’: 0}
- Make change from 80% to 81% with set_ruleset
Command:
[vagrant@checkmk ~]$ curl “localhost/test/check_mk/webapi.py?action=set_ruleset&_username=automation&_secret=4c550ece-c5eb-4456-b04a-b5fa4df4c18e&output_format=python” -d “request={‘ruleset_name’:‘checkgroup_parameters:filesystem’,‘ruleset’: {‘’: [{‘conditions’: {}, ‘value’: {‘levels’: (81.0, 90.0)}, ‘options’: {}}]}, ‘configuration_hash’: ‘b4765a55eca77acc5b0a57e1d2ef9be4’}}”
Result:
{‘result’: u"Check_MK exception: Failed to parse JSON request: ‘{‘ruleset_name’:‘checkgroup_parameters:filesystem’,‘ruleset’: {’‘: [{‘conditions’: {}, ‘value’: {‘levels’: (81.0, 90.0)},
‘options’: {}}]}}}’: Expecting property name: line 1 column 2 (char 1)", ‘result_code’: 1}
But according the URL it is a valid JSON Free Online JSON Validator - FreeFormatter.com
Side note:
Documentation has some typo in it
6.1. get_ruleset
root@linux# **curl “myserver/mysite/check_mk/webapi.py?action=get_ruleset&_username=automation&_secret=myautomationsecret&output_format=python” -d ‘request={“ruleset_name”:“checkgroup_paramters:filesystem”}’
checkgroup_paramters:filesystem should be checkgroup_parameters:filesystem (with e in parameters)
And I’m aware that not everything support JSON