Closed serverchief closed 1 year ago
cmk
is fundamentally a dumb CLI that just calls an API and processes the API response, and for API requests it doesn't know what a non-Enabled resourcestate could be. Instead, you can use something like jq to filter out hosts you don't need from the json response. Something like this would be a very large feature (implemented in the backend or CLI). Any PRs and other ideas are welcome!
I think this is most definately an API request and not a cmk one. If to be implemented in cmk it would be part of an extension on the filter option. There is anothe request for the filter option open (also a larger feature)
Based on the discussion, it won't be possible to implement this feature in cmk. It's possible only if the API server (mgmt server) allow for such a feature, for now workaround may be possible by piping the cmk output to something like jq etc.
Lets take listHosts as an example, when running list hosts resourcestate=Enabled state=Up, requires for end user to memorize (or lookup) and separately query other states.
Perhaps we can use NOT (!) operand and do something like this?
this would print all hosts that are NOT Enabled and NOT Up...