Hello,
i’m here to ask some help about getting started with retreiving data within rest apis.
Since i’m totally new of checkMK i’m in need of some help cause i’m not able to understand how to recover some data or if it’s possible.
Reading documentation, I’ve learned how to recover all hosts from APIs ( /api/1.0/domain-types/host_config/collections/all?effective_attributes=false&include_links=false ) , Then from this result i can recover all hosts and, for each host, i can check the services ( /api/1.0/objects/host/{hostname}/collections/services ) and then the status of every single service of that host.
This kind of process, by the way, is very long, expecially if there are thousands of elements to check everytime.
What i’d need, is a way to recover all hosts that have any service status not equal to 0 (OK). So i can retrieve only elements that are in a state of warn/crit/uk . This would help me to discover more easly and faster the elements that are having problems.
Is there any kind of API that i’m missing that can do that?
I thank you in advance for any advice and help provided.
Hello.
Thank you so much for your answer. This really saved my day.
Also because, this API doesn’t appear in the swagger and i can’t understand why?! It’s absolutely the result i was looking for!
Columns must be defined with (multiple) “&columns=” parameters.
The available columns are documented in the api/doc/#section/Table-definitions and the manual creation of API queries is explained under api/doc/#section/Querying-Status-Data