brennerm / check-mk-web-api

Python library to talk to the Check_Mk Web API
https://brennerm.github.io/check-mk-web-api/
MIT License
53 stars 26 forks source link

get_all_sites missing? #33

Closed dblviking closed 3 years ago

dblviking commented 3 years ago

As per this https://checkmk.com/check_mk-werks.php?werk_id=6689

get_all_sites works via curl but I don't see that interface in your release

Thank you!

brennerm commented 3 years ago

I confirmed that they work but they aren't part of the official docs. Hence I asked checkmk whether they can be considered stable. Let's see what they say.

dblviking commented 3 years ago

In the meantime, is there a way to fetch all sites using your module? Cheers

brennerm commented 3 years ago

Yes, you can use WebApi(...).make_request("get_all_sites")

dblviking commented 3 years ago

It looks like it needs one more parameter:

  File "/usr/local/lib/python3.6/site-packages/check_mk_web_api/__init__.py", line 164, in make_request
    raise CheckMkWebApiException(result)
check_mk_web_api.exception.CheckMkWebApiException: Check_MK exception: This API call requires the parameter output_format=python
dblviking commented 3 years ago

It looks like it needs one more parameter:

  File "/usr/local/lib/python3.6/site-packages/check_mk_web_api/__init__.py", line 164, in make_request
    raise CheckMkWebApiException(result)
check_mk_web_api.exception.CheckMkWebApiException: Check_MK exception: This API call requires the parameter output_format=python

Never mind! I didn't notice the parameters were in dict format. It's working :)

make_request("get_all_sites",query_params= { 'output_format': 'python'})

brennerm commented 3 years ago

Correct, forgot to add the query_params. So as you've guessed it's make_request('get_all_sites', query_params={'output_format': 'python'})