Class: Pupmin::Reports
- Inherits:
-
Object
- Object
- Pupmin::Reports
- Defined in:
- lib/pupmin/reports.rb
Overview
shortcuts for some useful report information
Class Method Summary collapse
-
.by_status(status: 'changed', latest: true, options: {}) ⇒ Object
Get a list of reports by their status; defaults to just latest report.
- .call_query(query, options = {}, endpoint = 'reports') ⇒ Object
-
.get_aged(threshold: 7200, options: {}) ⇒ Object
Get a list of “aged” agents, i.e servers that last submitted a report > threshold.
Class Method Details
.by_status(status: 'changed', latest: true, options: {}) ⇒ Object
Get a list of reports by their status; defaults to just latest report
10 11 12 13 14 15 16 17 18 |
# File 'lib/pupmin/reports.rb', line 10 def self.by_status(status: 'changed', latest: true, options: {}) query = [ 'AND', ['=', 'status', status.to_s], ['=', 'latest_report?', latest.to_s] ] call_query(query, ) end |
.call_query(query, options = {}, endpoint = 'reports') ⇒ Object
4 5 6 7 |
# File 'lib/pupmin/reports.rb', line 4 def self.call_query(query, = {}, endpoint = 'reports') puppetdb = Pupmin::PuppetDB.build puppetdb.request(endpoint, query, ) end |
.get_aged(threshold: 7200, options: {}) ⇒ Object
Get a list of “aged” agents, i.e servers that last submitted a
report > threshold
22 23 24 25 |
# File 'lib/pupmin/reports.rb', line 22 def self.get_aged(threshold: 7200, options: {}) query = ['in', 'certname', ['extract', 'certname', ['select_nodes', ['<', 'catalog_timestamp', Pupmin::Util.(threshold.to_i)]]]] call_query(query, , 'facts/fqdn') end |