Using the API to list hosts

The CFEngine reporting API can be used to query information about your infrastructure on the command line or for integration with other tools you have.

To retrieve a list of all your hosts bootstrapped to a hub, simply run the following from the command line:

curl -k --user admin:admin https://<HUBADDRESS>/api/query -X POST -d \
'{ "query": "SELECT Hosts.HostName, Hosts.IPAddress FROM Hosts"}'


The response will include a count attribute, which will tell you how many hosts you have bootstrapped, together with the actual list.

To see more examples of using the API, please see the API example documentation.
Have more questions? Submit a request

Comments

Powered by Zendesk