Feature #1890

Implement a host status API call

Added by Rytis Sileika almost 10 years ago. Updated over 9 years ago.

Target version:
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:


Currently it is not possible to obtain host status for a particular host via API.

I mean host status like it is displayed in the host list screen:

- out of sync (S)
- building (B)
- active (A)
- no changes (O)
- error (E)

Something like: /hosts/FQDN/status

Associated revisions

Revision 8dc8a9ac (diff)
Added by Joseph Magen over 9 years ago

fixes #1890 api host status

Revision f9c3c9c4 (diff)
Added by Ohad Levy over 9 years ago

refs #1890, typo


#1 Updated by Ohad Levy almost 10 years ago

what about /hosts/fqdn/reports/last ?

#2 Updated by Rytis Sileika almost 10 years ago

But that only returns puppet report status, ie number of failed modules, stuff like that. It doesn't tell whether node is in "build" state, or haven't checked in for a long time (ie 'out of sync')?

I might be making up things as I speak from memory, can't check it right now - will check the reports/status url output when back in the office....

#3 Updated by Rytis Sileika almost 10 years ago

So /hosts/FQDN/reports/last gives me this:

                {"message":"Finished catalog run in 3.25 seconds"},
        {"log":{"messages":{"message":"Could not intern from pson: source '\"#<Puppet::Node:0x7f' not in PSON!"},
        {"log":{"messages":{"message":"Unable to fetch my node definition, but the agent run will continue:"},

Which is perhaps OK for the hosts that are already built. But it does not tell me whether the host is set to be built. If I click on build, all reports are deleted, and I don't even get the info above.

Here's what I wanted to do, may be that would serve as a use case: I want to schedule a periodic host rebuild task:
  1. Create an empty VM object in VMware
  2. Register in Foreman
  3. PXE boot
  4. Wait for the node to finish building
  5. Do something else with the built VM

So steps 1-3 are easy to implement, but I got stuck at checking when the build is completely finished. There are ways of doing that, but just having a simple API call that would tell me various states (Building, Active, No changes, etc) would be very helpful... :)

#4 Updated by Greg Sutcliffe almost 10 years ago

I think there are other good use cases for this as well. For example, it would be trivial to use this to build a set of Nagios checks that report if hosts stay in a certain state too long.

#5 Updated by Joseph Magen over 9 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Joseph Magen

I submitted a pull request with status names

  • missing
  • failed
  • pending
  • changed
  • unchanged
  • unreported

I don't have a status yet for "building"

#6 Updated by Joseph Magen over 9 years ago

New status names. Sames is UI hover hints on List of Hosts page.

"Pending Installation"
"Alerts disabled"
"No reports"
"Out of sync"
"No changes"

#7 Updated by Ohad Levy over 9 years ago

  • Category set to API
  • Target version set to 1.1

#8 Updated by Anonymous over 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF