Project

General

Profile

« Previous | Next » 

Revision e54016da

Added by Marek Hulán over 8 years ago

Fixes #10782 - global host status

Introduce new global host status that is composed of host substatuses.
Each substatus defines a mapping to the global one which can result in
three values
  • OK
  • WARN
  • ERROR

Plugins can add their own substatuses. These are automatically
propagated also to API.

Thanks to Tomas Strachota who wrote the original code.

View differences:

app/services/report_importer.rb
end
# convert report status to bit field
st = ReportStatusCalculator.new(:counters => raw['status']).calculate
st = ReportStatusCalculator.new(:counters => raw['status']).calculate
# we update our host record, so we won't need to lookup the report information just to display the host list / info
host.last_report = time if host.last_report.nil? or host.last_report.utc < time
# we save the report bit status value in our host too.
host.puppet_status = st
# if proxy authentication is enabled and we have no puppet proxy set, use it.
host.puppet_proxy_id ||= proxy_id
......
# Check for errors
inspect_report
logger.info("Imported report for #{name} in #{(Time.now - start_time).round(2)} seconds")
host.refresh_statuses
end
private

Also available in: Unified diff