Process rule invalid via web API

Hello,

My problem is simple : i want to create a rule via the WEB API. To do so, i am doing these steps :

curl “http://myserver/mysite/check_mk/webapi.py?action=set_ruleset&_username=automation&_secret=myautomationsecret&request_format=python” -d “request={‘ruleset_name’:‘inventory_processes_rules’, {‘condition’: {}, ‘value’: {‘default_params’: {‘cpu_rescale_max’: True}, ‘match’: ‘~(.)tomcat2(.)’, ‘descr’: ‘tomcat2’}, ‘options’: {‘description’: u’tomcat2’}}}”

However, this ruleset and the one below (i have tried with 2 different rules of process) are not working.
(i am a new user so i can post only 2 “links”, i am removing http:// to be able to post this question…)

curl “…myserver/mysite/check_mk/webapi.py?action=set_ruleset&_username=automation&_secret=myautomationsecret&request_format=python” -d “request={‘ruleset_name’:‘static_checks:ps’, ‘ruleset’: { ‘’: [{ ‘conditions’: { ‘host_name’: [‘26.0.48.43’], ‘host_tags’: [] }, ‘options’: {‘description’: u’testnumber2’},‘value’: (‘ps’, ‘tomcat’, {‘process’: ‘/test/’, ‘cpu_rescale_max’: True, ‘user’: ‘~toto’}) }], } }”

They both raise an invalid rule error.

{“result”: “Check_MK exception: Invalid rule {‘conditions’: {‘host_name’: [‘26.0.48.43’], ‘host_tags’: []}, ‘options’: {‘description’: u’testnumber2’}, ‘value’: (‘ps’, ‘tomcat’, {‘process’: ‘/test/’, ‘cpu_rescale_max’: True, ‘user’: ‘~toto’})}”, “result_code”: 1}

What i am doing wrong ? Is there any way to solve this ?
The example in the document is for the ruleset “checkgroup_parameters:filesystem” which is quite different from processes, so i didn’t dare to copy paste the same syntax even if the conditions are similar…

Thanks a lot in advance, this API is very useful and i wish i could use it better.
Tom

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.