Sha256: bb93d0608aab47427a865d37976ad9039e80bba168e3d122f8a8c7284a4a0044
Contents?: true
Size: 811 Bytes
Versions: 2
Compression:
Stored size: 811 Bytes
Contents
require "open3" module Sensu module Run class Check attr_reader :name, :namespace, :output, :status def initialize(options={}) @options = options @name = @options[:check_name] @namespace = @options.fetch(:namespace, "default") end def exec! stdin, stdout, stderr, wait = Open3.popen3(@options[:command]) @output = "#{stdout.read}\n#{stderr.read}" @status = wait.value.exitstatus [@output, @status] end def to_hash { :metadata => { :name => @name, :namespace => @namespace }, :command => @options[:command], :output => @output, :status => @status, :ttl => @options.fetch(:ttl, 0) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sensu-run-0.3.0 | lib/sensu/run/check.rb |
sensu-run-0.2.0 | lib/sensu/run/check.rb |