How can we get the information of only running machines(Bootsrapped)

Hi Folks,

    I Want go get the information of only running machines which are already bootstrapped.Let say i bootstrapped 100 machines and in those 40 are not running.Now i need to get only the 60 machines which are running.What command i need to run from my workstation.

knife node status? is this the correct command.

There isn’t a specific command to do exactly that but we can cover some options.

  1. you probably don’t want knife node status, that rather misleadingly only applies to Push Jobs Clients
  2. instead you can use knife status which will show the last checkin time of nodes

Chef doesn’t have any awareness of whether machines are down or not, only that they haven’t checked in in some time. You could filter based on that but there isn’t anything inherent to find whether a node is not running.

Cheers,
Seth Thomas

This help’s.Thank you so much Seth Thomas.

You could use knife ssh “name:*” “uptime”

Which would attempt to logon to all machines and then parse the results.

Hi budgester,

        Getting --socketError. Please find the attached logs.

[empadmin@chefworkstation ~] sudo knife ssh "name:*" "uptime" WARNING: Failed to connect to easedb01.vsihq.local -- SocketError: getaddrinfo: Name or service not known WARNING: Failed to connect to octopus-svr -- SocketError: getaddrinfo: Name or service not known WARNING: Failed to connect to ELIGSW01.devtest.local -- SocketError: getaddrinfo: Name or service not known WARNING: Failed to connect to ELIGAPP02.devtest.local -- SocketError: getaddrinfo: Name or service not known WARNING: Failed to connect to ELIGAPP01.devtest.local -- SocketError: getaddrinfo: Name or service not known WARNING: Failed to connect to adtest.test.local -- SocketError: getaddrinfo: Name or service not known WARNING: Failed to connect to tiber.devtest.local -- SocketError: getaddrinfo: Name or service not known [empadmin@chefworkstation ~]

By default it’s going to try to ssh using the node names - you can append -a ipaddress and it should use the IP of the default route to try to connect.

-cheeseplus