Class: PEClient::Resource::PuppetDB::QueryV4::Reports
- Defined in:
- lib/pe_client/resources/puppet_db/query.v4/reports.rb
Overview
Puppet agent nodes submit reports after their runs, and the Puppet Server forwards these to PuppetDB. Each report includes:
-
Data about the entire run
-
Metadata about the report
-
Many events, describing what happened during the run
After this information is stored in PuppetDB, it can be queried in various ways.
-
You can query data about the run and report metadata by making an HTTP request to the reports endpoint.
-
You can query data about individual events by making an HTTP request to the #events endpoint.
-
You can query summaries of event data by making an HTTP request to the #event_counts or #aggregate_event_counts endpoints.
Constant Summary collapse
- BASE_PATH =
The base path for PuppetDB Query v4 Reports endpoints.
"#{QueryV4::BASE_PATH}/reports".freeze
Instance Method Summary collapse
-
#events(hash:, query: nil, **kwargs) ⇒ Hash+
Returns all events for a particular report, designated by its unique hash.
-
#get(query: nil, **kwargs) ⇒ Hash+
If
:queryis absent, PuppetDB will return all reports. -
#logs(hash:) ⇒ Array<Hash>
Returns all logs for a particular report, designated by its unique hash.
-
#metrics(hash:) ⇒ Array<Hash>
Returns all metrics for a particular report, designated by its unique hash.
Methods inherited from Base
Constructor Details
This class inherits a constructor from PEClient::Resource::Base
Instance Method Details
#events(hash:, query: nil, **kwargs) ⇒ Hash+
Returns all events for a particular report, designated by its unique hash.
Most of PuppetDB’s query endpoints support a general set of HTTP URL parameters that can be used for paging results. PuppetDB also supports paging via query operators, as described in the AST documentation.
59 60 61 62 |
# File 'lib/pe_client/resources/puppet_db/query.v4/reports.rb', line 59 def events(hash:, query: nil, **kwargs) @client.get "#{BASE_PATH}/#{hash}/events", params: {query: query&.to_json}.merge!(QueryV4.query_paging(**kwargs)).compact end |
#get(query: nil, **kwargs) ⇒ Hash+
If :query is absent, PuppetDB will return all reports.
Most of PuppetDB’s query endpoints support a general set of HTTP URL parameters that can be used for paging results. PuppetDB also supports paging via query operators, as described in the AST documentation.
46 47 48 |
# File 'lib/pe_client/resources/puppet_db/query.v4/reports.rb', line 46 def get(query: nil, **kwargs) @client.get(BASE_PATH, params: {query: query&.to_json}.merge!(QueryV4.query_paging(**kwargs)).compact) end |
#logs(hash:) ⇒ Array<Hash>
Returns all logs for a particular report, designated by its unique hash. This endpoint does not currently support querying or paging.
84 85 86 |
# File 'lib/pe_client/resources/puppet_db/query.v4/reports.rb', line 84 def logs(hash:) @client.get "#{BASE_PATH}/#{hash}/logs" end |
#metrics(hash:) ⇒ Array<Hash>
Returns all metrics for a particular report, designated by its unique hash. This endpoint does not currently support querying or paging.
72 73 74 |
# File 'lib/pe_client/resources/puppet_db/query.v4/reports.rb', line 72 def metrics(hash:) @client.get "#{BASE_PATH}/#{hash}/metrics" end |