Sha256: 83b641bdb432d2aa77b2312d72cd50891212e7094dbe159a926c25401f894b6b

Contents?: true

Size: 699 Bytes

Versions: 36

Compression:

Stored size: 699 Bytes

Contents

module Perus::Pinger
    class Running < Command
        description 'Reports "yes" if "process_path" is running, "no"
                     otherwise. Valid values for "process_path" are contained
                     in the pinger config file.'
        option :process_path, restricted: true
        metric!
        
        def run
            begin
                ps_result = shell("ps aux | grep -v grep | grep #{options.process_path}")
            rescue ShellCommandError
                ps_result = ''
            end
            
            metric_name = "#{File.basename(options.process_path)}_running"
            {metric_name => ps_result.empty? ? 'no' : 'yes'}
        end
    end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
perus-1.0.6 lib/perus/pinger/metrics/running.rb
perus-1.0.5 lib/perus/pinger/metrics/running.rb
perus-1.0.4 lib/perus/pinger/metrics/running.rb
perus-1.0.3 lib/perus/pinger/metrics/running.rb
perus-1.0.2 lib/perus/pinger/metrics/running.rb
perus-1.0.1 lib/perus/pinger/metrics/running.rb
perus-1.0.0 lib/perus/pinger/metrics/running.rb
perus-0.1.35 lib/perus/pinger/metrics/running.rb
perus-0.1.34 lib/perus/pinger/metrics/running.rb
perus-0.1.33 lib/perus/pinger/metrics/running.rb
perus-0.1.32 lib/perus/pinger/metrics/running.rb
perus-0.1.31 lib/perus/pinger/metrics/running.rb
perus-0.1.30 lib/perus/pinger/metrics/running.rb
perus-0.1.29 lib/perus/pinger/metrics/running.rb
perus-0.1.28 lib/perus/pinger/metrics/running.rb
perus-0.1.27 lib/perus/pinger/metrics/running.rb
perus-0.1.26 lib/perus/pinger/metrics/running.rb
perus-0.1.25 lib/perus/pinger/metrics/running.rb
perus-0.1.24 lib/perus/pinger/metrics/running.rb
perus-0.1.23 lib/perus/pinger/metrics/running.rb