Class: Dropsonde::Metrics::Environments
- Inherits:
-
Object
- Object
- Dropsonde::Metrics::Environments
- Defined in:
- lib/dropsonde/metrics/environments.rb
Overview
environments plugin
Class Method Summary collapse
- .cleanup ⇒ Object
- .description ⇒ Object
- .example ⇒ Object
- .initialize_environments ⇒ Object
- .run(_puppetdb_session = nil) ⇒ Object
- .schema ⇒ Object
- .setup ⇒ Object
Class Method Details
.cleanup ⇒ Object
50 51 52 |
# File 'lib/dropsonde/metrics/environments.rb', line 50 def self.cleanup # run just after generating this metric end |
.description ⇒ Object
11 12 13 14 15 16 |
# File 'lib/dropsonde/metrics/environments.rb', line 11 def self.description # This is a Ruby squiggle heredoc; just a multi-line string with indentation removed <<~DESCRIPTION This group of metrics gathers information about environments. DESCRIPTION end |
.example ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/dropsonde/metrics/environments.rb', line 41 def self.example # this method is used to generate a table filled with randomized data to # make it easier to write data aggregation queries without access to the # actual private data that users have submitted. [ environment_count: rand(1..100), ] end |
.initialize_environments ⇒ Object
5 6 7 8 9 |
# File 'lib/dropsonde/metrics/environments.rb', line 5 def self.initialize_environments # Require any libraries needed here -- no need to load puppet or puppetdb; # they're already loaded. This hook is named after the class name. # All plugins are initialized at startup before any metrics are generated. end |
.run(_puppetdb_session = nil) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/dropsonde/metrics/environments.rb', line 34 def self.run(_puppetdb_session = nil) # return an array of hashes representing the data to be merged into the combined checkin [ environment_count: Puppet.lookup(:environments).list.count, ] end |
.schema ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dropsonde/metrics/environments.rb', line 18 def self.schema # return an array of hashes of a partial schema to be merged into the complete schema [ { "description": 'The number of environments', "mode": 'NULLABLE', "name": 'environment_count', "type": 'INTEGER', }, ] end |
.setup ⇒ Object
30 31 32 |
# File 'lib/dropsonde/metrics/environments.rb', line 30 def self.setup # run just before generating this metric end |