How do I get all node objects from chef server in the form of json?

I can use this command to return one node object from chef server:

knife node show -l --format=json <node_name>

I want to get all node objects (as json) to be able to write my own reports.

Is there a way to query the chef DB directly?


knife search '*:*' --format=json is probably more of what you want. Also check out knife download nodes/ to get them as files.

With the help of unix pipe we can achieve this very easily.

Getting all the nodes names is easy

knife node list

Combine with some filter

knife node list | grep myhost

Get the node for all the hosts your are interested in

knife node list | grep myhost | xargs -n 1 knife node show -l -Fj

Need Your Help

Pythonbrew install ZSH on Ubuntu

python ubuntu zsh pythonbrew

Can anyone shed any light on how to have pythonbrew / pythonz install when my shell is ZSH. I am on ubuntu 12.04.

Linux All Output to a File

linux pipe stdout stderr io-redirection

Is there any way to tell Linux system put all output(stdout,stderr) to a file?