CMK version:2.1.0p25
OS version:RHEL 8.7
Hello everyone,
i have a few problems with the new RestAPI and maybe y’all here can help me.
I try to get a service from a host, using the request “Show all monitored services”.
The problem here is, that it seems that i can’t change the displayed columns, because if i try, all i get is "Unknown column: services.[...]"
I already fixed my broken query, but can’t seem to find the problem in my columns-definition.
My script is written in python3. I already wrote a new API-Class for the RestAPI and trying to understand the referenced input, which is descriped in the “ReDoc” of Check_MK.
The columns aren’t complicated or something, just:
["host_name", "host_address", "state", "plugin_output", "host_contact_groups", "tags"]
All my inputs are correctly parsed into the url.
I heared, there are some problems with this specific request, but i need it for my future automation scripts (i want all Services of a name, not just form one host).
This is the example code in the “ReDoc” documentation:
query_string = urllib.parse.urlencode({
"host_name": 'example.com', # A hostname.
"query": '{"op": "=", "left": "host_name", "right": "example.com"}', # An query expression of the Livestatus 'services' table in nested dictionary form.
"columns": ['host_name', 'description'], # The desired columns of the `services` table.
})
My columns-definition are also a list-type, but maybe there is an undocumentated change i’m not seeing?
The interactive Rest-API GUI sadly has no example for this request, that’s why i hope i can get help here.
All i can find are examples for bash-curl requests, but i specific want an urllib-request type. That way my coworkers also can use it.
Can someone relate or given me a soluation to that problem? Giving code-examples will be hard, because it’s separated into a class and execute-script, but if wished, i can try to migrate them to an example script.
Regards, Kruzgoth