Class: Sensu::Plugin::CLI
- Inherits:
-
Object
- Object
- Sensu::Plugin::CLI
- Includes:
- Mixlib::CLI
- Defined in:
- lib/sensu-plugin/cli.rb
Direct Known Subclasses
Sensu::Plugin::Check::CLI, Metric::CLI::Graphite, Metric::CLI::JSON, Metric::CLI::Statsd
Constant Summary collapse
- @@autorun =
Behind-the-scenes stuff below. If you do something crazy like define two plugins in one script, the last one will ‘win’ in terms of what gets auto-run.
self
Instance Attribute Summary collapse
-
#argv ⇒ Object
Returns the value of attribute argv.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv = ARGV) ⇒ CLI
constructor
A new instance of CLI.
-
#output(*args) ⇒ Object
Implementing classes should override this to produce appropriate output for their handler.
-
#run ⇒ Object
Implementing classes must override this.
Constructor Details
#initialize(argv = ARGV) ⇒ CLI
Returns a new instance of CLI.
11 12 13 14 |
# File 'lib/sensu-plugin/cli.rb', line 11 def initialize(argv=ARGV) super() self.argv = self.(argv) end |
Instance Attribute Details
#argv ⇒ Object
Returns the value of attribute argv.
9 10 11 |
# File 'lib/sensu-plugin/cli.rb', line 9 def argv @argv end |
Class Method Details
.method_added(name) ⇒ Object
46 47 48 49 50 |
# File 'lib/sensu-plugin/cli.rb', line 46 def method_added(name) if name == :run @@autorun = self end end |
Instance Method Details
#output(*args) ⇒ Object
Implementing classes should override this to produce appropriate output for their handler.
19 20 21 |
# File 'lib/sensu-plugin/cli.rb', line 19 def output(*args) puts "Sensu::Plugin::CLI: #{args}" end |
#run ⇒ Object
Implementing classes must override this.
36 37 38 |
# File 'lib/sensu-plugin/cli.rb', line 36 def run unknown "Not implemented! You should override Sensu::Plugin::CLI#run." end |